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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

How to Make Stage Name & Status Reason to be thesame

(0) ShareShare
ReportReport
Posted on by
Hello
 
I want the system to auto-change the status Reason to be thesame data as the BPF Stage Name. i.e everytime the user changes the stage name to Created, the Status Reason will change to Created, everytime the user changes the BPF Stage name to Review, Status Reason will change to Review and when the user changes the BPF Stage Name to Closed, the Status Reason will be changed to Closed. 
 
Is this possible please and if yes, how? 
 
I have the same question (0)
  • Suggested answer
    Dengliang Li Profile Picture
    Microsoft Employee on at
    Hi,
     
    This can be implemented via JavaScript.
    function onload(executionContext){
        var formContext = executionContext.getFormContext();
        // get the status field
        var Status = formContext.getAttribute("statuscode");
        // get current stage name
        var currentStage = formContext.data.process.getActiveStage().getName();
     
        // After the page loads, set the status field value to the current stage name.
        switch (currentStage) {
            case "Identify":
                Status.setValue(100000000);
                break;
            case "Research":
                Status.setValue(100000001);
                break;
            case "Resolve":
                Status.setValue(100000002);
            default:
                break;
        }
     
        //add stage change event
        formContext.data.process.addOnStageChange(myFunction);
       
        // When the stage changes call this function to set the status field value to the current stage name.
        function myFunction(executionContext){
        var formContext = executionContext.getFormContext();
        var Status = formContext.getAttribute("statuscode");
        var currentStage = formContext.data.process.getActiveStage().getName();
            switch (currentStage) {
                case "Identify":
                    Status.setValue(100000000);
                    break;
                case "Research":
                    Status.setValue(100000001);
                    break;
                case "Resolve":
                    Status.setValue(100000002);
                default:
                    break;
            }
        }
    }
     
    The relevant APIs are referenced below.
     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more.
    If you have further questions, please feel free to contact me .
     
    Best Regards,
    Dengliang Li
     
  • Brendaama Profile Picture
    on at
    Hey Dengliang Li
     
    Thank you for your response.
     
    Is it possible to achieve this without a Js?
  • JustRhonda Profile Picture
    99 on at
    There may be a way to do it using Power Automate. I haven't tried this but found this : https://www.ameyholden.com/articles/cchange-bpf-business-process-flow-stage-power-automate
    Good luck!
  • Brendaama Profile Picture
    on at
    @justRhonda, thank you but is it possible to use Business rules to effect this?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans