Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Make users to land on Active Stage in BPF

(0) ShareShare
ReportReport
Posted on by 1,075

Hello,

I am looking for a solution to make users to automatically land on Active Stage "Negotiate" (on Quote entity) in BPF as soon as he/she opens Opportunity record inside CRM. Any thoughts?

For Example: I have Sales BPF defined on Opportunity entity and uses Quote entity for Negotiate stage. If Salesperson goes and opens an opportunity record for which a Quote has already been created, the focus should directly move and land on Negotiate stage (on Quote entity). See below image:

Negotiate-Landing-page.jpg

*This post is locked for comments

  • Verified answer
    RE: Make users to land on Active Stage in BPF

    Thanks Nithya it worked. Ofcourse thanks a bunch to Gotham for the master code. Thank you all others for your valuable responses.

    Here is the final JScrip that worked very well with Dyn365 online:

    function SetActiveStage() {   
    var currentStageId = Xrm.Page.data.process.getActiveStage().getId();
    var selectedStageId = Xrm.Page.data.process.getSelectedStage().getId();
    if (currentStageId != selectedStageId) {
    Xrm.Page.data.process.setActiveStage(currentStageId, callbackFunction);
    Xrm.Page.data.refresh();
    }
    }

    function callbackFunction() {

    var callback = function(){
    var activeStage = parent.document.querySelector(".processStageContainer.activeStage");
    if(activeStage)
    activeStage.click();
    };

    if (document.readyState === "complete" ||
    (document.readyState !== "loading" && !document.documentElement.doScroll)) {
    callback();
    } else {
    document.addEventListener("DOMContentLoaded", callback);
    }

    }
  • Verified answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,076 on at
    RE: Make users to land on Active Stage in BPF

    Hi Vijayakumar,

    Try replacing the code as shown below.

    parent.document.querySelector(".processStageContainer.activeStage");

    Hope this helps.

  • RE: Make users to land on Active Stage in BPF

    Goutham,

    The below statement is not giving true. It gives null. you know why? I am using Dyn365 online Free Trail.

    var activeStage = document.querySelector(".processStageContainer.activeStage");

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,076 on at
    RE: Make users to land on Active Stage in BPF

    Hi Vijayakumar,

    Refer the link below.

    neilparkhurst.com/.../javascript-add-code-on-business-process-flow-change-and-select

  • Suggested answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Make users to land on Active Stage in BPF

    Hi,

    This should help you

    www.inogic.com/.../scripting-on-business-process-flow-in-crm-2015-part-i

    msdn.microsoft.com/.../dn817878.aspx

  • Verified answer
    gdas Profile Picture
    gdas 50,089 Moderator on at
    RE: Make users to land on Active Stage in BPF

    Hi ,

    Try with this . Trigger SetActiveStage in onload event of the form.

            function SetActiveStage() {
                var currentStageId = Xrm.Page.data.process.getActiveStage().getId();
                var selectedStageId = Xrm.Page.data.process.getSelectedStage().getId();
                if (currentStageId != selectedStageId) {
                    Xrm.Page.data.process.setActiveStage(currentStageId, callbackFunction)
    
                }
            }
            
            function callbackFunction() {
                var activeStage = document.querySelector(".processStageContainer.activeStage");
                if (activeStage)
                    activeStage.click()
            }

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... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans