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 :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

How to change entity form on stage change?

(0) ShareShare
ReportReport
Posted on by

Hi!

I have a customer who wants a different form for each stage of opportunity entity sales process. Ie. different form for Offer and Negotiation stage.

I found a solution to change the form with javascript (Xrm.Page.ui.formSelector.items.get(formId).navigate( ); function). I can not however figure out how to trigger the said javascript on stage change.

Busines Process Flow has abiltiy to trigger workflow either on "Stage Entry" or "Stage Exit". I can not however figure out how to trigger my javascript (web resource)from the workflow.

I have two questions

How do I run web resource(javascript) from workflow?

Is there some other way I can change the form of an entity on stage change?

I have the same question (0)
  • meelamri Profile Picture
    13,216 User Group Leader on at
    RE: How to change entity form on stage change?

    Hi,

    What version of CRM are you using?

  • Community Member Profile Picture
    on at
    RE: How to change entity form on stage change?
    [quote user="Mehdi El Amri"]

    Hi,

    What version of CRM are you using?

    [/quote]

    Hi! 

    The version is

    2021 release wave 1 enabled

    Server version: 9.2.21035.00176

    Client version: 1.4.2511-2103.5

  • Verified answer
    meelamri Profile Picture
    13,216 User Group Leader on at
    RE: How to change entity form on stage change?

    You can use OnStageChange event:

    "This event occurs when the stage of a business process flow control changes. This event occurs when the user clicks the Next Stage or Move to previous stage buttons in the user interface or when a developer uses the formContext.data.process.moveNext or formContext.data.process.movePrevious methods. You can’t cancel the stage change using code in a handler for this event."

    Please refer to the documentation: docs.microsoft.com/.../onstagechange

    Let me know if you need some guidance to implement your code.

  • Community Member Profile Picture
    on at
    RE: How to change entity form on stage change?

    Thank you! This was really simple solution.

    For anyone else wondering same thing it is as simple as

    function OnFormLoad(){

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

    }
    Then you just call the OnFormLoad function from web resources from form properties. 

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 74 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 62 Most Valuable Professional

#3
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 57

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans