Skip to main content

Notifications

Announcements

No record found.

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

  • Sai Ankith MCP Profile Picture
    Sai Ankith MCP 45 on at
    RE: Alert on changing BPF

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

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Alert on changing BPF

    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
    Sai Ankith MCP 45 on at
    RE: Alert on changing BPF

    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
    Alex Fun Wei Jie 33,626 on at
    RE: Alert on changing BPF

    Hi,

    register formonload function in onloadevent, the addonstagechange will register.

  • Sai Ankith MCP Profile Picture
    Sai Ankith MCP 45 on at
    RE: Alert on changing BPF

    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
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Alert on changing BPF

    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.

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Alert on changing BPF

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

    }

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Alert on changing BPF

    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.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans