Overview
This is a case study with Workflow.
Scenario:
I'm starting to work with workflow and without creating triggers on the various fields in a table I would like to find out if there is a way with workflow that I can basically check the state of a field (in this case it would an av_flag) so when the field changes from a 1 to a 0 or a 0 to a 1 or null to a 1 I want to fire an emial off letting me know that has changed. I kind of have this working but what's happening is that when I think I have it correct it will fire off 2 workflow objects not just the one I'm working with. I have created many additional av_flag fields in co_customer_ext and For internal auditing this is where we control access to our website based on the values that are checked. I need for data validation, I need to have a single email fire off for each of the fields that change states.
Solution
If you want to check for the condition of a field changing values, from any value to any other value, then on the Workflow Rule you can:
- Select the Object
- Select the data object you want to check
- Select the field you want to check in data object control
- Select both the trigger on new value and the trigger on old value checkboxes. Selecting both of these is the equivalent of trigger on changed value. See Workflow_Rule#Managing_Records for more.
Alternate Solution
Given the case study above, in which you're checking to see if any of multiple values changed, you might want to try to consolidate all of these into a single Workflow Rule. The reason for this is to minimize the performance impact of firing multiple rules.
To do this, in your Rule, don't provide a Data Object. Just select the Trigger on Update flag. Then, in the Rule, have a series of Condition checks that check to see if any of the audit fields have been updated. If true then send an email.
In the email template, you can list all the different audit fields that have changed by putting these parsed values one line each:
The following fields have changed:
{?*ind_flag_01_ext == ind_flag_01_ext? ? Flag 01 has changed!<br />?}
{?*ind_flag_02_ext == ind_flag_02_ext? ? Flag 02 has changed!<br />?}
This solution could only work if there should be one consolidated email for all these conditions.
If different people get different emails based on different fields, then use the original #Solution.