Hey, I have a field that triggers the following javascript OnChange:
function set_bpf_stage(executionContext) {
var formContext = executionContext.getFormContext(); // Get the form context
stageId ="e22ec2aa-24f3-4bcf-ab0c-998e74ae79f6";
formContext.data.process.setActiveStage(stageId, function (response) {
// This is the callback function
if (response) {
console.log("Stage successfully changed to ID: " + stageId);
} else {
console.log("Failed to change stage.");
}
}, function (error) {
console.log("Error setting stage: ", error.message);
});
}
The issue is, the code only works if I change the field twice. The first time the state goes to Unsaved and nothing happens, the second time I change the value it saves and the correct bpf stage is set. Why is this happening? I've tried manually saving and refreshing after the field is changed once and nothing happens.