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

Community site session details

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

How to call Javascript on Process Stage Next button in CRM

(0) ShareShare
ReportReport
Posted on by 267

Hello Team,

I want to call Javascript on Process Stage Next button in CRM how can i call can you suggest me ?

I have the same question (0)
  • Suggested answer
    meelamri Profile Picture
    13,216 User Group Leader on at
    RE: How to call Javascript on Process Stage Next button in CRM

    Hi, 

    You can register your JS function on OnPreStageChange Event or OnStageChange Event. 

    Please Refer to docs: 

    Good Luck ! 

  • Suggested answer
    Manoj Mane Profile Picture
    1,020 on at
    RE: How to call Javascript on Process Stage Next button in CRM

    Hi Ashik Patel,

    Check the below document from Microsoft that shows all the events and methods available in JavaScript

    https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/developers-guide/gg334481(v=crm.8)?redirectedfrom=MSDN#BKMK_OnStageChange

    Reference Code:-

    Xrm.Page.data.process.addOnStageChange(onStageChange);

    function onStageChange()

    {
    // Alert either "next" or "previous" based on button clicked.
    alert(ExecutionContextObj.getEventArgs().getDirection());

    if(ExecutionContextObj.getEventArgs().getDirection()==="next")
    {
    //your code goes here 

    }

    if(ExecutionContextObj.getEventArgs().getDirection()==="previous")

    {
    }
    }

    Thanks,
    Manoj.

    Please mark this as VERIFIED if it helps.

     

  • Suggested answer
    Mohsin Ali Profile Picture
    3,634 on at
    RE: How to call Javascript on Process Stage Next button in CRM

    Yes Ashik Patel  - you can use below handler at onload event to call your function.

    formContext.data.process.addOnStageChange(YourFunction);

    Please refer below link for more details.

    docs.microsoft.com/.../addonstagechange

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 235

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 177

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 156 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans