|This week's theme: Cool Tech Tips|
This week's topic was recommended by a member of the AR System Developer Community.
Last week we defined the EXTERNAL operator and provided you with some rules for using it. This week we'll delve into what happens at execution time and provide you with some advanced topics.
What Happens At Execution Time?
First, an attempt is made to obtain the value of the field passed to the EXTERNAL operator. If the field does not exist, is not a character field, or the value of the field is empty, the EXTERNAL operator will return a value of TRUE.
It is important to remember that the EXTERNAL operator will always resolve to a value of TRUE or FALSE, with TRUE being the default value. This can affect whether or not your qualification will succeed or your workflow will execute.
For example, let's say I have a table field qualification that will show me records where I am the submitter, and I want to dynamically modify that qualification to obtain some additional criteria from the $fieldValue$ field. If my data record satisfies the $Submitter$ = 'Submitter' portion of the qualification, both of the qualifications below will succeed if the EXTERNAL operator resolves to TRUE, whereas only the second one will succeed if the EXTERNAL operator resolves to FALSE.
$Submitter$ = 'Submitter' AND EXTERNAL($fieldValue$)
$Submitter$ = 'Submitter' OR EXTERNAL($fieldValue$)
Using the result of the EXTERNAL operator, in combination with other data, can result in different behavior based on how you use these within your qualification.
The EXTERNAL operator also supports some advanced behavior for those of you who want to take things a step further.
Alternative Qualification Format
In addition to supporting a qualification in an unparsed format, as described above, the field value supplied to an EXTERNAL operator can also be in the format used internally by AR System. This format represents the qualifier as a serialized string. This additional format provides you with the ability to prepare the parsing in advance for efficiency.
Use the following special Run Process commands to convert a qualification into the internal format:
Nesting EXTERNAL Operators
The value of a field passed to an EXTERNAL operator can even contain other nested EXTERNAL references. This provides a way for you to recursively define EXTERNAL operators. A note of caution: as with other types of workflow that provide ways to do this, be careful not to define circular references within your workflow.
The following demonstrates a simple example of how to take advantage of this functionality:
Let's say you have defined a Run If condition as
If at execution time the 'fieldName' field contains the value
'Submitter' = "Joe User" AND EXTERNAL('externalValue')
And the 'externalValue' field contains the value
'Create Date' >= "1/1/2002"
The final Run If qualification, after all of the EXTERNAL operators are evaluated, would be
'Submitter' = "Joe User" AND 'Create Date' >= "1/1/2002"
Using the above general rules, and understanding the logic behind the EXTERNAL operator, will help you to create flexible and dynamic qualifications resulting in more robust applications.
Senior Software Engineer, Remedy Engineering
Joined Remedy in April 1998, focusing on Remedy native client development
"It is amazing what you can accomplish if you do not care who gets the credit." Harry S. Truman