TCS Tools: SetActiveProcess custom workflow activity

By | April 28, 2017

SetActiveProcess custom workflow activity which comes with TCS Tools allows you to switch active process for a record to a process of your choice. There were some changes in how business processes work in the Fall 2016 release of Dynamics 365, so you might want to read this article first:

Concurrent Business Processes in Dynamics 365

In short, every record can have more than one active process now, and, whenever a CRM user decides to switch his/her process for a particular record, that change does not necessarily affect other users – they will still be working with the process they have selected for that record.

This is an interesting functionality, and it allows for some new scenarios; however, what seems to be missing is the ability to switch the process for a whole team/department. If two sales people are working in the same sales department, it’s only reasonable for both of them to be using the same process when it comes to the opportunity records, for example. At the same time, marketing department might choose to use a completely different process, but, again, they might want it to be the same for all marketing users.

SetActiveProcess custom workflow activity gives you exactly those options:

  • You can use it in a synchronous/asynchronous workflow to switch active process for a record
  • You can also define a team of users pass and it as a parameter to this activity – it will, then, switch the process for all members of that team

There are some screenshots below..

Here is an entity for which I have two business processes defined, and I’m using a two-option “Server Process Switch” field to trigger the workflow 

 

 

Here is a workflow that will start whenever “Server Process Switch” field value is modified – it’s using “Set Active Process” custom workflow activity

Here is how the properties of that custom worfklow activity are set for the first of the steps

A few notes about that last screenshot, btw:

  • Make sure to choose correct process into the “Process” field. Business processes are, basically, workflows, so you’ll have to find it in the list
  • Team is an optional parameter. If you don’t pass it to the workflow activity, it will switch the process for the user which it is running under (that’ll be current CRM user if it’s a synchronous workflow, and that’ll be workflow owner user if it’s an asynchronous workflow)

Here is how the team looks like – there are two users in the team

 

 

That’s all there is – nothing else is required.

I just updated my “Server Process Switch” field and set it to “Second”. Then I went to CRM under another user account which is a member of the team, and here is what I see

 

The process is, now, different (compare this to the first screenshot in this post).

There is one additional piece of this puzzle you may need to know about, though. Since the process is switched on the server side, Dynamics does not pick up those changes on the client side automatically. If you re-open the form on the client side, it’ll work just fine. However, in my example above, if simply created that two-option field, selected a new value, clicked save, and, then, used a workflow to switch the process, I would not notice the change till I re-loaded/re-opened the form.

There is a workaround for that. I just need to use this kind of OnChange javascript handler for my two-option field:

function refreshProcessFlow()
{
Xrm.Page.data.refresh(true).then(
function(){
Xrm.Utility.openEntityForm(“<ENTITY NAME>“, Xrm.Page.data.entity.getId());
}
, null);
}

It will do two things:

  • It will save the data
  • And, then, it will reload the form

Leave a Reply

Your email address will not be published. Required fields are marked *