[UNSUPPORTED] Update CRM Workflows from database


IMPORTANT: It is not recommended to perform any operation directly on CRM database (exception to SSRS reports using filtered views). Execution of below script surly saves time, but it may crash your entire CRM environment if done in wrong way. Take a backup of your database before trying it.

I had an implementation were we were required to have send email step (without using CRM email template) in around 100 workflow process. All these emails used HTML email template with a branding URL in it which was hard coded.

One fine day a request came to update the branding URL in all emails. I was like ok, but next thing was in few hours. I just said, few hours?

There were around 100+ workflows using it. Apart from that each email was not a simple text email, all were HTML emails.

What that mean is, I was required to create 100 new HTML email templates with updated URL, deactivate all these workflows, modify the send email step in each workflow manually, and activate the workflows in FEW HOURS.

I’m still searching for a supported way of doing this with minimal manual efforts and time. If you have any, please let me know.

All these constrains forced me to move to UNSUPPORTED way. I came to point where I decided to update the URL from database.

All the process are stored in “workflow” table and the workflow definition in “xaml” column in xaml format.

update workflow set xaml=@Xaml where workflowid=@WorkflowId

Updating this column is not that straight forward like updating any other column. You will have to figure out the way to play with XAML values which I’m sure you will. J

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s