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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

How to set value in custom field on basis of Business process flow stage

(0) ShareShare
ReportReport
Posted on by 45

I have to new custom field called Stage.Now i want to update this field whenever business process flow stage change.for Ex if i move businees process flow stage to  In progres then this value i have to update in custom field called Stage.In Business process flow we have 3 options New,In progress & Close

1325.dynamics.PNG

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    You can check this - www.cloudfronts.com/.../

  • Community Member Profile Picture
    on at

    Hi Partner,

    You can try to use js code in the onload event, it can directly update field value based on actived stage name.

    In my example, opportunity has a bpf, which named opportunity sales process and has four stage.

     pastedimage1609925622356v1.png

    1.write js code.

     

    function formonload() {
        Xrm.Page.data.process.addOnStageChange(getStage); // Trigger the function when move to next stage.
        getStage();
    }
    function getStage() {
        var activeStage = Xrm.Page.data.process.getActiveStage();
        var stagename = activeStage.getName();
        switch (stagename) {
            case "Qualify":
                Xrm.Page.getAttribute("new_stage1").setValue(0);
                break;
            case "Develop":
                Xrm.Page.getAttribute("new_stage1").setValue(1);
                break;
            case "Propose":
                Xrm.Page.getAttribute("new_stage1").setValue(2);
                break;
            default:
                Xrm.Page.getAttribute("new_stage1").setValue(3);
        }
    }

    2.Go Settings > Customizations > Customize the system > web resource to add it.

    pastedimage1609925558166v6.png

     pastedimage1609925466595v5.png

    3.Go Settings > Customizations > Customize the system > entities > opportunity > forms > open main form to click form porperties.

     pastedimage1609925411735v4.png

    4.Add web resource you just created.

     pastedimage1609925267683v1.png

    4.test.

    pastedimage1609925333738v2.png  pastedimage1609925391040v3.png

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Community Member Profile Picture
    on at

    Hi Partner,

    Has the problem been solved? Any updates?

    Please click Yes under "Did this answer your question?" to close this thread.

     pastedimage1610505342959v1.png

    Thanks. 

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 131 Super User 2026 Season 1

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 46 Most Valuable Professional

#3
NeerajPawar Profile Picture

NeerajPawar 41

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans