Hi people,
I was working on Business process flow automation. I am having one optionset field which holds the same options as I am having the stages in BPF. I had to write script for automatic change of field's optionset value according to stage of Business Process Flow. So when I am clicking on "next stage" button, the field is changing but the unsaved changes notification is still there. this I am unable to remove. Can anybody suggest any effective method to achieve that. I am using below code:
function mainFunc()
{
Xrm.Page.data.process.addOnStageChange(StateChanged);
}
function StateChanged() {
var selectedStage = Xrm.Page.data.process.getSelectedStage().getName();
var stage1 = 100000000;
var stage2 = 100000001;
var stage3 = 100000002;
 
if (selectedStage == "Stage1") {
Xrm.Page.getAttribute("new_pipelinephase").setValue(stage1);
}
if (selectedStage == "Stage2") {
Xrm.Page.getAttribute("new_pipelinephase").setValue(stage2);
}
if (selectedStage == "Stage3") {
Xrm.Page.getAttribute("new_pipelinephase").setValue(stage3);
}
Xrm.Page.data.entity.save();
}
Here new_pipelinephase is the schema name of optionset field.


Report
All responses (
Answers (