Skip to content

Commit 1fa731e

Browse files
committed
Update Application form
1 parent a1dc8d3 commit 1fa731e

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

OFM.Application.WebResources/Scripts/FormHandler/ofm_Application.Form.js

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ OFM.Application.Form = OFM.Application.Form || {};
88
//Formload logic starts here
99
OFM.Application.Form = {
1010
onLoad: function (executionContext) {
11-
//debugger;
11+
debugger;
1212
let formContext = executionContext.getFormContext();
1313
switch (formContext.ui.getFormType()) {
1414
case 0: //undefined
@@ -21,6 +21,7 @@ OFM.Application.Form = {
2121
this.showBanner(executionContext);
2222
this.filterCreatedBySPLookup(executionContext);
2323
this.filterSubmittedByLookup(executionContext);
24+
this.showCCFRIParticipation(executionContext);
2425
break;
2526

2627
case 2: // update
@@ -36,6 +37,8 @@ OFM.Application.Form = {
3637
this.showUnionList(executionContext);
3738
this.showOtherDescription(executionContext);
3839
this.notForProfitSection(executionContext);
40+
this.showCCFRIParticipation(executionContext);
41+
this.hideEligibilityTab(executionContext);
3942
break;
4043

4144
case 3: //readonly
@@ -45,6 +48,8 @@ OFM.Application.Form = {
4548
this.showUnionList(executionContext);
4649
this.showOtherDescription(executionContext);
4750
this.notForProfitSection(executionContext);
51+
this.showCCFRIParticipation(executionContext);
52+
this.hideEligibilityTab(executionContext);
4853
break;
4954

5055
case 4: //disable
@@ -501,7 +506,7 @@ OFM.Application.Form = {
501506
lockStatusReason: function (executionContext) {
502507
debugger;
503508
var formContext = executionContext.getFormContext();
504-
if (formContext.getAttribute("statuscode").getValue() == 6) { //Approved
509+
if (formContext.getAttribute("statuscode").getValue() == 6) { //Approved
505510
var roles = Xrm.Utility.getGlobalContext().userSettings.roles.getAll();
506511
var disable = true;
507512
for (var i = 0; i < roles.length; i++) {
@@ -584,5 +589,41 @@ OFM.Application.Form = {
584589
console.log(error.message);
585590
}
586591
);
592+
},
593+
showCCFRIParticipation: function (executionContext) {
594+
debugger;
595+
var formContext = executionContext.getFormContext();
596+
var facility = formContext.getAttribute("ofm_facility").getValue();
597+
var facilityid;
598+
if (facility != null) {
599+
facilityid = facility[0].id;
600+
Xrm.WebApi.retrieveRecord("account", facilityid, "?$select=ofm_program").then(
601+
function success(results) {
602+
console.log(results);
603+
if (results["ofm_program"] === 2 || results["ofm_program"] === 4) {
604+
formContext.getControl("ofm_ccfri_participation").setVisible(true);
605+
606+
}
607+
else {
608+
formContext.getControl("ofm_ccfri_participation").setVisible(false);
609+
}
610+
},
611+
function (error) {
612+
console.log(error.message);
613+
}
614+
);
615+
}
616+
},
617+
618+
hideEligibilityTab: function (executionContext) {
619+
debugger;
620+
var formContext = executionContext.getFormContext();
621+
var applicationType = formContext.getAttribute("ofm_application_type").getValue();
622+
if (applicationType == 1) { //NEW
623+
formContext.ui.tabs.get("tab_11").setVisible(true);
624+
}
625+
else {
626+
formContext.ui.tabs.get("tab_11").setVisible(false);
627+
}
587628
}
588629
}

0 commit comments

Comments
 (0)