Difference between revisions of "Workflow Condition Examples"

From SmartWiki
Jump to: navigation, search
(Example of Incorrect Configuration)
 
(11 intermediate revisions by one other user not shown)
Line 1: Line 1:
There are two rules that must be followed when adding multiple connectors to a workflow task that incorporate conditional logic statements:
+
#REDIRECT [[Workflows_Overview#Workflow_Condition_Examples]]
# Collectively, the conditions on each task must accommodate every possible permutation.
 
# Each condition must be mutually exclusive from every other.
 
 
 
Let's discuss each of these rules.
 
 
 
==Rule #1: Collectively, the conditions on each task must accommodate every possible permutation.==
 
 
 
===Example of Incorrect Configuration===
 
* Three [[types]] exist in a given [[UTA|application]], with [[Determining the typeid|typeIDs]] of 12345, 45678 and 67890.
 
* Two connectors are set up on a workflow task with conditions of:
 
:* ''"@typeid@"="12345"'' and
 
:* ''"@typeid@"="45678"'', respectively
 
* If the workflow is fired against a record associated with typeID 67890, the workflow will never progress to the next task.
 
 
 
===Examples of Correct Configuration===
 
* As above, three [[types]] exist in a given [[UTA|application]], with [[Determining the typeid|typeIDs]] of 12345, 45678 and 67890.
 
* Three connectors are set up on a workflow task with conditions of:
 
:* ''"@typeid@"="12345"'',
 
:* ''"@typeid@"="45678"'' and
 
:* ''"@typeid@"="67890"'', respectively
 
* '''Alternatively''', two connectors with the following conditions could be set up:
 
:* ''"@typeid@"="12345"'' and
 
:* ''"@typeid@"!="12345"'' (not equal to "12345"), respectively
 
 
 
* In all cases, when using logical conditions on connectors, the conditions must encompass all possible logical scenarios.
 
 
 
==Rule #2: Each condition should be mutually exclusive from every other.==
 
 
 
===Example of Incorrect Configuration===
 
* Three [[types]] exist in a given [[UTA|application]], with [[Determining the typeid|typeIDs]] of 12345, 45678 and 67890.
 
* Two [[status]]es exists in the same application, with [[Determining the statusid|statusIDs]] of 888 and 999.
 
* The system administrator wishes to send emails via workflow if the record is in one of the above statuses. One email should be sent out if the type is 12345 or 45678 and a different email should be sent out if a different type has been used.
 
* Two connectors are set up on a workflow task with conditions of:
 
:* ''"@typeid@" in ("12345","45678") AND "@statusid@" in ("888","999")'' and
 
:* ''"@parent.statusid@" in ("888","999")''
 
* The issue here is that both statements [[Boolean Operators|evaluate]] as '''true''' if the statuses on the record triggering the workflow have a statusID of 888 or 999.
 
* The workflow process will not "know" which task to connect to. The workflow will progress, but not necessarily to the next intended workflow task. In other words, the wrong email may be sent.
 
 
 
===Example of Correct Configuration===
 
 
 
 
 
 
 
<!--Say for example that a given [[UTA]] contains seven different [[template]]s. One set of emails should be sent if a [[Level 1 Entity|Level 1]] record of one template is saved in a particular status, and another set of emails should be sent if a record is saved of a different template at the same status. If the record is of any of the other five templates, no email should be sent.
 
 
 
 
 
 
 
A logical statement can be added to workflow connectors in the Condition field, enabling you to specify which workflow task will be triggered.
 
 
 
'''Example'''
 
Branching Logic can be implemented to send an approval message to Senior Management when the request is over $100,000, while requests under $100,000 will take a different path when the workflow is triggered.
 
 
 
[[Image:newconnector.jpg]]
 
 
 
In general the Workflow Condition is used with several different connectors attached to a task. Collectively the conditions on each task should accommodate every possibility.
 
*'''Note''': because the sequence in which the system accesses each connector is not configurable '''it is important that the conditions are mutually exclusive'''. For example, if you have 3 connectors for different paths based on a particular value the conditions could be:
 
:* '''"@Selection@"="Yes"'''
 
:* '''"@Selection@"="No"'''
 
:* '''"@Selection@"!="Yes" and "@Selection@"!="No"''' 
 
:::* The last statement could also be represented as '''"@Selection@" not in ("Yes","No")'''
 
 
 
==Sample Conditions==
 
* '''@Request Amount.value@>100000'''
 
* '''"@date(fullstartdate)@">"2013-01-01"'''
 
* '''"@date(currentdate)@">"@system.submission deadline@"'''
 
 
 
You can also use MYSQL syntax to perform calculations within the Condition:
 
* '''date_format(now(),"%d")="01"'''
 
::* This condition will be true only on the 1st of the month. This could be used with a '''[[Recurring Workflow]]''' that loops daily if you wish to send out a summary e-mail on the 1st of every month. See [[Recurring Workflow|here]] for further details.-->
 
 
 
=See Also=
 
* [[Workflow Condition]]
 
* [[Workflow Connector]]
 
* [[Completing an Acknowledgment Workflow]]
 
 
 
[[Category:Workflows]]
 

Latest revision as of 14:13, 20 July 2017