Last active
April 13, 2021 21:43
-
-
Save melamriD365/e1c4ff1c985ba0448e314609f02b1553 to your computer and use it in GitHub Desktop.
How to set up complex conditions for business process flow ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof (MEA) == "undefined") { MEA = {} }; | |
if (typeof (MEA.Opportunity) == "undefined") { MEA.Opportunity = {} }; | |
if (typeof (MEA.Opportunity.OpportunityForm) == "undefined") { MEA.Opportunity.OpportunityForm = {} }; | |
MEA.Opportunity.OpportunityForm = { | |
onLoad: function (executionContext) { | |
var formContext = executionContext.getFormContext(); | |
formContext.getAttribute('budgetamount').addOnChange(this.setNeedApproval); | |
formContext.getAttribute('mea_riskscode').addOnChange(this.setNeedApproval); | |
formContext.getControl('mea_isneedapproval').setDisabled(true); | |
}, | |
setNeedApproval: function (executionContext) { | |
var formContext = executionContext.getFormContext(); | |
var budgetamount = formContext.getAttribute("budgetamount").getValue(); | |
var risks = formContext.getAttribute("mea_riskscode").getValue(); | |
//(BUDGETAMOUNT >= 100000 OR (50000 <= BUDGETAMOUNT < 100000 AND (RISK = RISK 1 OR RISK = RISK 2)) | |
if ((budgetamount >= 100000) || (budgetamount >= 50000 && budgetamount < 100000 && risks!=null && (risks.includes(278490000) || risks.includes(278490001)))){ | |
formContext.getAttribute('mea_isneedapproval').setValue(true); | |
formContext.ui.process.reflow(true); | |
} | |
else{ | |
formContext.getAttribute('mea_isneedapproval').setValue(false); | |
formContext.ui.process.reflow(true); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment