A workflow trick so you can simulate "contains", "does not contain", "starts with", "ends with" in your workflow conditions

(for version 5.1)
This requires intermediate knowledge of sql server and is not for the faint of heart, but it can be a useful tool if you want some good, robust workflows that don’t have to be hardcoded when things change.

For workflow conditions, there aren’t any “contains”, “starts with”, “ends with” or “does not contain” operators, but you can make them happen by inserting values from the database side.

1. for the action you wish to constrain with conditions, add an arbitrary condition that you will edit

2. figure out which workflowactionid you’re dealing with. They often look like this:

3. locate the workflow conditions (table: workflowconditions)

4. update the row with the arbitrary condition keeping in mind that the values become concatenated into a sql where clause when the workflow is executed

This means if you put the following values in the following fields:
ColumnName :: Opportunity.Org
Operator :: Like
ExpectedValue :: %RD% (don’t put quotes in there)

Then the workflow will fire every time the Opportunity’s org contains the value ‘RD’ because it will concatenate to :
where opportunity.org like ‘%RD%’

So in this example, if you had say a multi-company database where some but not all of the companies had a department RD, and you wanted to execute a workflow for opportunities belong to that department for any company, then this is how you would do it. That way if you ever added a new company or a department RD to an existing company you wouldn’t have to go update your workflow conditions. This workflow condition would still validate. This way you can avoid enumerating all the conditions that have to match exactly, which over time creates prohibitive amounts of workflow conditions to try to manage and maintain.

Have a great day!


One thought on “A workflow trick so you can simulate "contains", "does not contain", "starts with", "ends with" in your workflow conditions

Comments or questions for Loren?

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 )

Connecting to %s