Duplicate workflows appearing in advanced find – CRM 365

Today while trying to call an on demand a workflow in a custom plugin, I started to see that CRM was throwing an error similar to: “The workflow should be an on-demand workflow or child workflow” and the most frustrating thing was that this workflow was already set with that configuration(On Demand). Searching for the workflow in the Advanced Find of my MS Dynamics CRM 365 environment, I noticed that several “duplicates” of the workflow appeared. Although they had the same name, some of them were in Draft Mode and two were Active. One curious thing that I saw was that whenever I did a change in one of my Active workflows, the other was replicating the change. This made me had a hard time trying to figure out what was happening, specially because after searching the duplicates in the Default solution to delete them, only one appeared.

Searching on internet, I found that whenever you Activate or publish a Workflow, a snapshot of the workflow is also created. This was the reason of why I had several “duplicates”, because in the past I did Activate/Deactivate the workflow several times and many snapshots were created. To get the correct “version” of the workflow, I just had to add a filter by searching for Type = Definition. With this, I ensured that the workflow that I was getting was the latest one and not an old snapshot.

Hope it helps.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s