web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Strange Problem Settin...
Power Apps
Answered

Strange Problem Setting BPF Stage

(0) ShareShare
ReportReport
Posted on by 23

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. 

Categories:
I have the same question (0)
  • AK-06092009-0 Profile Picture
    23 on at

    I do not need to use javascript to do this, I just need it to be real-time. I've looked into using a workflow, but I do not see an option to choose the fields I require. I should see the "Record Type" selector here, but I don't:

    adrian60642_0-1701508174620.png

     

  • Verified answer
    AK-06092009-0 Profile Picture
    23 on at

    Solution: Utilize a post-operation plugin as it it can be synchronous. Javascript was conflicting with the save of the bpf.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#2
11manish Profile Picture

11manish 205 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard