Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

PowerObjects Blog 

for Microsoft Business Applications


Two Tips for Business Process Flows

Post Author: Joe D365 |

Business Process Flows in Dynamics CRM are great tools to help your organization operate smoothly and effectively and can be an integral and important part of a CRM implementation. Depending on your business processes, adding a Business Process Flow to your system can give end users a visualization of where they are at in the sales process and what needs to be completed. Today we’ll be showing you how to add script that will programmatically advance a Business Process Flow stage and we will also show you the steps needed to increase your Business Process Flow Limits. There’s lot of good stuff to get to today, so let’s begin!

Programmatically Advancing Business Process Flows

Navigating through a Business Process Flow is easy but can add extra clicks for users. Advancing a stage in the Business Process Flow is as easy as clicking Next Stage on the right-hand side of the process flow interface. Depending on the type of step, you may need to click it or type information into it. In high volume environments, such as call centers, end users might be clicking the same steps and stages in the Business Process Flow navigation hundreds of times per week. Saving an extra few clicks here and there really add up in these situations.

Please note here that this code can be used with CRM 2015 SP1. There have been some changes for programmatically setting business process flows between CRM 2015 and CRM 2015 SP1. The code below will need to be passed through currentstage, which is available from Xrm.Page.data.process.getActiveStage();

function moveNext(currentStage) {

//Method is used to attempt to move to the next stage in the Business Process Flow

//currentStage is expected to be the current stage name of the record when this method is to be invoked

//console.log("moveNext requested for stage: " + Xrm.Page.data.process.getActiveStage().getName());

var pollingAttemptsRemaining = 10;

var intervalId;

//Cycle through code every 2 seconds for dirty check

intervalId = setInterval(function () {

pollingAttemptsRemaining -= 1;

//console.log("Attempts Remaining: " + pollingAttemptsRemaining);

//Check if the current stage is the same stage that record was in when calling moveNext

//This check is in place after 2015 SP1 due to changes in CRM code handling of moveNext with being called onSave with a dirty form

//Out Of Box moveNext calls an additional save which causes code to be executed twice, this prevents further execution

if (Xrm.Page.data.process.getActiveStage().getName() != currentStage) {

clearInterval(intervalId);

}

//Check if form is dirty, if it is not and the stage has not changed then attempt to moveNext

if (!Xrm.Page.data.entity.getIsDirty() && Xrm.Page.data.process.getActiveStage().getName() == currentStage) {

console.log("attempting move");

Xrm.Page.data.process.moveNext(moveResult);

pollingAttemptsRemaining = 0;

clearInterval(intervalId);

}

//If number of attempts remaining has passed exit code

if (pollingAttemptsRemaining <= 0) { clearInterval(intervalId); } }, 200); This code would be triggered on the onChange of a field. However, there could be a use case to also trigger the onLoad of a form. A common occurrence of this code would be a stage with steps that are also on the form of an entity. Once the user sets the value of the field which is on the form, the step in the Business Process Flow will also change. Once the field is changed and saved, if the trigger is set to onChange on that field, the Business Process Flow will advance to the next stage. Increasing Business Process Flow Limits

Business Process Flows are highly configurable to fit your organizational needs and are available for out-of-the-box entities as well as your own custom entities. Additionally, an entity can have many business process flows associated with it. Out-of-the-box CRM allows for 10 business process flows per entity, however, this can be an issue if certain entities require more processes than is allowed. Thankfully, a few simple steps are all that is needed to increase your Business Process Flow Limits!

Out-of-the-box CRM allows for only 10 Business Process Flows per entity, however, if your CRM is an on-premises deployment, this number can be modified to better fit your business needs. This modification is NOT supported by Microsoft, however, simply follow the steps given below and there should be no negative repercussions. With that being said, let’s get started!

  1. Access the setting which is stored in your CRM database in the table organization.
  2. The setting you will want is called MaximumActiveBusinessProcessFlowsAllowedPerEntity.
  3. Enter the number of flows you wish to set.

sd

As you can see from the example above, we have now successfully increased the Maximum Business Processes allowed per entity to 15!

That’s all for today’s blog! For more tips and tricks like this one, keep reading our blog each week, and remember to subscribe to our newsletter for CRM updates delivered directly to your inbox.

Happy CRM’ing!

 

Joe CRM
By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

6 comments on “Two Tips for Business Process Flows”

  1. Is there a way to increase number of stages per process? The current limit is 30.

  2. HI Joe, Thanks for sharing, unfortunately moveResult is undefined, any chance or correcting the code?

PowerObjects Recommends