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

Announcements

No record found.

News and Announcements icon
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,077

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

I have the same question (0)
  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    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()
            }
  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at
  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi Vijayakumar,

    Refer the link below.

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

  • Vijayakumar Kenchugundu Profile Picture
    1,077 on at

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

  • Verified answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi Vijayakumar,

    Try replacing the code as shown below.

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

    Hope this helps.

  • Verified answer
    Vijayakumar Kenchugundu Profile Picture
    1,077 on at

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

    }

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans