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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Alert on changing BPF

(0) ShareShare
ReportReport
Posted on by 45

I want to be able to create a pop-up whenever a user changes the stage in a business Process flow(bpf). However, I cannot see the fields for a BPF. I remember someone suggested me to use stageID field but they also told me that it would be deprecated with Dynamics 365 which is the version I am using. Can anyone please assist on how I should move ahead ?

Regards,

Ankith

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    You can use the following JS code to get the stage and based on that display a popup:

    var activeStage = Xrm.Page.data.process.getActiveStage();

    var stageId = activeStage.getId();

    var stageName = activeStage.getName();

    if (stageName == 'Assessment')

    {

      alert('Display Message Here!!!');

    }

    Hope this helps.

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    yes, stageid is going to deprecated. You can use addOnStageChange and getActiveStage method.

    https://blogs.msdn.microsoft.com/crm/2017/07/30/how-to-determine-which-business-process-flow-bpf-instance-is-shown-when-a-record-is-opened-2/

    function formonload()

    {

    Xrm.Page.data.process.addOnStageChange(getStage); // Trigger the function when move to next stage.

    }

    function getStage()

    {

    var activeStage = Xrm.Page.data.process.getActiveStage();

    var stageId = activeStage.getId();

    var stagename = activeStage.getName();

    alert(stagename);

    }

  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Ankith,

    You need to use the supported script for business process flow. If you want to show the alert then any of the above houls work in your case.

    Refer these MSDN links for more details:

    msdn.microsoft.com/.../dn817874.aspx

    msdn.microsoft.com/.../gg334701.aspx

    Hope this helps.

  • Sai Ankith MCP Profile Picture
    45 on at

    Hello Wei Ji Fun,

    This looks good however it works only when you open a record(form onload). I am not sure how to handle when changing the stages without loading the form. Any thoughts ?

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    register formonload function in onloadevent, the addonstagechange will register.

  • Sai Ankith MCP Profile Picture
    45 on at

    Thanks a lot ! However, I need to create a pop-up using different fields on the bpf when the person changes the stage from stage 3 to stage 4. Can anyone explain how I handle this ?

    @Fun: Your solution alerts the stage name as pop-up while I need to alert different values from the fields of BPF. I need to give alert only when a person changes the stage from "Quote the Products" to "Approve and Activate"

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    according to the pdf you sent me via linkedin.

    You have to change the getstage to displayAlert, because you are changing the function name.

  • Sai Ankith MCP Profile Picture
    45 on at

    Yes i realized it too. Thank you for being so helpful. You are awesome !! Thanks All !!

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…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ZS-27011425-0 Profile Picture

ZS-27011425-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans