Defining actions for a rule


The Set Fields tab applies to all rule types except Auto Approval, Self Approval, and Completion rules. You use the Set Fields tab to define the actions for the rule. For example, for a Get Authority rule, you can define a query to retrieve a signature authority amount from the AP-Sample:Signature Authority form and set that amount into a temporary field on the AP:Signature form.

When you construct assignments using the Set Fields tab, you can also use currency, date, and time fields, currency functions such as CURRCONVERT, CURRSETDATE, CURRSETTYPE, or CURRESETVAL, and date functions such as DATEDIFF, DATENAME, DATENUM, or DATEADD.

Depending on the rule type, the Set Fields tab provides the following action options in the Set Fields Type field:

  • Value—Use this action to assign a value to a particular field.
  • Query—Use this action to specify a form (from the current server or another server) and qualification for a query to that form. You can assign the value of any field from the queried form. If no match is found for the qualification, a NULL value is assigned. If multiple matches are found, the value assigned depends on the If Multiple Rows setting on the Basic tab.
  • SQL—Use this action to specify an SQL command to be run on the Approval Server or another database. You can assign the value from any returned column. If the command finds no entries, a NULL value is assigned. If it finds multiple entries, the value assigned depends on the If Multiple Rows setting on the Basic tab.
  • Process—Use this action to specify a process to be run on theApproval Server. If the command returns an empty string or an error, a NULL value is assigned.
  • Other—This setting enables you to specify an action by using an AR System filter. For more information, see Workflow-objects.

When you select the type of action, the buttons and fields in the qualification area change according to the action type.

Example of the Set Fields tab for a Value

The following figure illustrates a rule that uses Value as the Set Fields Type. In this example, the rule uses the Value Set Fields Type to assign a value to a particular field. This value can be a hard-coded value, a keyword, or a value from a field of a schema.
Set Fields tab for a value
22_1_approval_rule_set_fields_tab.png

Example of the Set Fields tab for a Query

The following figure illustrates a Get Authority rule from the sample applications that makes a query to the AP-Sample:Signature Authority form. In this example, the rule uses a query to the AP-Sample:Signature Authority form to retrieve the signature dollar limit for the current approver.

 Set Fields tab for the Get Authority rule with a query
22_1_approval_rule_set_fields_type_query.png

Example of the Set Fields tab for an SQL command

The following figure illustrates a Get Authority rule from the sample applications that specify an SQL command to be executed on the AP-Sample:Signature Authority form. This form has a T274 table in the AR System database. To successfully run an SQL query, you must provide the T-Table name. In this example, the rule specifies an SQL command that will retrieve the signature dollar limit for the current approver from the AP-Sample: Signature Authority form.

Set Fields tab for the Get Authority rule with an SQL command

22_1_approval_rule_set_fields_type_sql.png

In this SQL command (SELECT C536870914 FROM T274 WHERE C8 = '$Approver$'):

  • C536870914 is the column ID of Signature Dollar Limit
  • T274 is the T-table of AP-Sample: Signature Authority
  • C8 is the column ID of Field Login Name

The resulting entries will have $Signature Dollar Limit$ as the first column. $1$ represents the value of $Signature Dollar Limit$.

Example of the Set Fields tab for a Process

The following figure illustrates a rule that uses process as the Set Fields Type. In this example, the rule specifies a process that will run on the Approval Server. You can specify any executable process, such as a batch file (only for Windows), a shell or Perl script, or any other application. The process must not contain any pauses, delays, or white spaces. The output of the process must be in the form of strings.

The output must be separated by the string defined in the Separator String field. After being separated by the separator, each resultant string will be represented by $1$, $2$, and so on. Make sure that the separator string in the Set Fields tab and the separator string in the application are the same.

 Set Fields tab for a process
22_1_approval_rule_set_fields_type_process.png

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*