Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Set next business process stage "active" using a workflow

Posted on by Microsoft Employee

I created a workflow step that checks a field in the business process whether it is set to "yes" and if it is I want to set the next stage active I just cant find how to set the next (or specific stage) active in a workflow step.

Thanks so much!

*This post is locked for comments

  • RE: Set next business process stage "active" using a workflow

    Did it work on Cross-Entity BPF? I need to set process stage to Negotiate (on Quote) from Evaluate (on Opportunity). Any thoughts?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set next business process stage "active" using a workflow

    I got it to work with v1.0.41 thank you!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set next business process stage "active" using a workflow

    Thanks Aric! I will try v1.0.37 and let you know how it is.

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Set next business process stage "active" using a workflow

    Have you used the workflow tools for anything else?

    Seems like version 1.0.51 is pretty new and might have a bug.

    We are on v1.0.37 on my current project and it is working properly.

    Possibly downgrade if you haven't used it yet.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set next business process stage "active" using a workflow

    Thanks just checked and the assembly is there...

  • Mohamed Bashir Profile Picture
    Mohamed Bashir 105 on at
    RE: Set next business process stage "active" using a workflow

    Barry, I would check plugin assemblies under system>customizations>customize the system  to see what assemblies are loaded on your environment.  You should have one labeled msdyncrmWorkflowTools.  If you do not, double check the solution install, and as recommended, test in a dev environment before pushing to prod

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Set next business process stage "active" using a workflow

    Hi Barry ,

    I am not sure using workflow it is possible or not ,Instead of workflow could you please registered one java script method  MoveBPFNextStageAutomatic() . This is working fine for me , hope this will help you.

    function MoveBPFNextStageAutomatic() {
        Xrm.Page.data.save().then(successCallback, errorCallback);
    }
    
    
    function errorCallback(message) {
        alert("error")
    }
    
    function successCallback(message) {
    
        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()
    }
  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set next business process stage "active" using a workflow

    Thanks so much Aric and Mohamed! I'm trying the Workflow Tools by Demian Raschkovan and I'm getting this error (please see image). Any advice? Please let me know if more info is needed to help me figure this out thanks!

    4862034.Capture.PNG

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Set next business process stage "active" using a workflow

    Your can write your own Custom Workflow Activity to move to the next stage, or use the Workflow Tools by Demian Raschkovan mentioned in the above post.

    The update is simple enough. You need to get the Record Id, Stage Id and the Process Id, and call the following function:

           private void UpdateStage(IOrganizationService service, EntityReference currentRecord, Guid processId, Guid stageId)

           {

               Entity current = new Entity(currentRecord.LogicalName);

               current.Id = currentRecord.Id;

               current["processid"] = processId;

               current["stageid"] = stageId;

               try

               {

                   service.Update(current);

               }

               catch (FaultException<OrganizationServiceFault> ex)

               {

                   throw new Exception("WorkflowUtils.ChangeProcessStage.UpdateStage: " + ex.Message);

               }

               catch (System.Exception ex)

               {

                   throw new Exception("WorkflowUtils.ChangeProcessStage.UpdateStage: " + ex.Message);

               }

           }

    Just make sure that if you have to bypass a stage, you Update the stage, and then update the next stage.

    For example if you want to move from Stage 1 to Stage 3, you call the Update function on Stage 2 and then call the Update function on Stage 3.

    Hope this helps.

  • Verified answer
    Mohamed Bashir Profile Picture
    Mohamed Bashir 105 on at
    RE: Set next business process stage "active" using a workflow

    I used the solution provided here to set a stage as active in my process based upon my check conditions.  It worked perfectly for our environment.  github.com/.../Dynamics-365-Workflow-Tools

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans