Dear Team,
we have following function which sets the BPF stage on Quote
Initially it was working but now it is not working as expected
Please have a look and suggest
setBPFStage: function () {
//function to set the BPF stage automatically based on opp and quote type
/*if Opportunity = empty --> Phase = Study
if Opportunity <> NULL
If Quote Type = Budget Quote: BPF = Budget Phase
If Quote Type = Firm Quote: BPF = Firm
*/
var activeProcess = formContext.data.process.getActiveProcess();
if (activeProcess != null) {
stage1Id = activeProcess.getStages().get(0).getId();
stage2Id = activeProcess.getStages().get(1).getId();
stage3Id = activeProcess.getStages().get(2).getId();
if (XrmAttribute.exists(thisForm.CONSTANTS.Attributes.OPP)) {
if (XrmAttribute.getValue(thisForm.CONSTANTS.Attributes.OPP) == null) {
XrmAttribute.setValue(thisForm.CONSTANTS.Attributes.ACTIVESTAGE, stage1Id);
}
else if (XrmAttribute.getValue(thisForm.CONSTANTS.Attributes.OPP) != null &&
XrmAttribute.getValue(thisForm.CONSTANTS.Attributes.OPP) != "undefined") {
if (XrmAttribute.exists(thisForm.CONSTANTS.Attributes.QUOTETYPE)) {
if (XrmAttribute.getValue(thisForm.CONSTANTS.Attributes.QUOTETYPE) == "100000001") {
//Budget = 100000001 ; Firm = 100000002
XrmAttribute.setValue(thisForm.CONSTANTS.Attributes.ACTIVESTAGE, stage2Id);
}
else
XrmAttribute.setValue(thisForm.CONSTANTS.Attributes.ACTIVESTAGE, stage3Id);
}
}
}
}
},
*This post is locked for comments