[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

Dialogs with Input Argument cannot be called as on demand

Dialog are mainly used to run on demand in CRM, but if your dialog is using Input Arguments, you cannot set the dialog to run on demand. You can only set it to run as child process. Logically it sounds ok as you will need some value to be passed to Input Argument before executing an dialog process, but CRM also provides a way to set a default value and setting default is mandatory. Now question is:

When we can have a default value for input arguments, why can’t we call such dialogs as On Demand? Why should I maintain an extra parent dialog to this?

dialog2.jpg

CRM 2011 : Dialogs with Input Argument cannot be called as on demand

Important to know (at least I didn’t knew it till date J).

Dialog are mainly used to run on demand in CRM, but if your dialog is using Input Arguments, you cannot set the dialog to run on demand. You can only set it to run as child process. Logically it sounds ok as you will need some value to be passed to Input Argument before executing an dialog process, but CRM also provides a way to set a default value and setting default is mandatory. Now question is:

When we can have a default value for input arguments, why can’t we call such dialogs as On Demand? Why should I maintain an extra parent dialog to this?