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 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

  • Community Member Profile Picture
    on at
    RE: How to set value in custom field on basis of Business process flow stage

    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.

  • Community Member Profile Picture
    on at
    RE: How to set value in custom field on basis of Business process flow stage

    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.

  • Suggested answer
    a33ik Profile Picture
    84,329 Most Valuable Professional on at
    RE: How to set value in custom field on basis of Business process flow stage

    Hello,

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

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,278 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,000 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans