Configuring Rule Actions
When you add an action to a rule and the action contains the word configure with a dotted line, you can (and sometimes must) configure some details about the action, such as adding input and output mappings, applying a filter, and sorting data.
See Actions for information about all the available actions and resources on how to use it.
The examples below illustrate how to configure a rule.
Certain actions require configuration to execute. The Create method, for example, needs to know which properties of the SmartObject must be populated. Mappings are performed between the SmartObject properties and fields in your view or form. Use the Context Browser on the right to drag and drop items on the Input Mappings page or click the Auto Map button for this to be done for you. You can also clear the current mappings.
You can return and store values for later use by specifying values on the Output Mappings page. This page indicates if values must be stored and where. Use the Context Browser to drag and drop return properties of the SmartObject into the mapping destinations. Click the Auto Map button for this to be done for you.
When you use an action such as Set a control's properties, you can configure the control's properties using items from the Context Browser.
Use the toggle button to change the type of input. This allows you to use static values or drag and drop values from the Context Browser.
- When using Boolean properties in rules on a view or form, true and false values can be represented as:
- True, False
- true, false
- 0, 1 (where 0=False;1=True)
- Yes, No
- You can populate the Expression property of a control with an existing expression from the Context Browser or the GUID of an existing expression.
- You can only map a drop- down to the values the control can accept. Note that these values may be different from the display values for the drop-down. For example, the Target drop-down of the Hyperlink control has the following display values: New Window, Current Frame and Current Window; but the corresponding value members are _blank, _self and _top (you can get these values by inspecting the drop-down’s HTML).
When you use methods such as the Get List method, you can filter values using fields, operators and values. To add a filter, click Add and select the Field, Operator and Value to configure the filter. If you need more than one filter, click Add again to add another filter. You can remove filters by using the Remove and Remove All buttons.
Configure advanced filters by clicking the Advanced button. This allows you to add Expressions to create a more advanced filter in which you can group conditions. Each condition has a number and is shown in an expression. Use the conditions and expressions to build a statement to filter the data according to your needs. You can add multiple expressions and conditions to build the statement and add brackets by clicking in the boxes between each condition to group conditions which allows you to control the order of execution. A Preview of the full expression is available below.
- You can use input mappings to limit the number of records returned. This is useful when you have a growing number of records and performance is becoming an issue. The more records you can filter out before the results return to the server, the better the performance of the view or form will be.
- If you filter items by using parameters on the method first, the filters may not work properly. As a troubleshooting tip, supply parameters only, look at the result set, and then apply a filter to the result set.
Use the Sort function to order the results returned on a view or form. You can add multiple sort mappings, but keep in mind that sorting happens in the order listed. Use the Move up and Move down buttons to move the position of a sort. You can sort columns ascending or descending. In the example below the results are sorted by the Customer Name first and then the Customer Number.
The Context Browser tab shows when you configure rules and expressions, and contains information such as system values, and content relating to the view or form, such as controls, SmartObject fields and more. Use these items to configure a rule or use them with operators to build an expression on a control.
Fields | Description | Example |
---|---|---|
System Values | ||
Current Date | ||
Current Date and Time | Today's date and current time, for example 2018-09-03 14:50:35Z. This is the date and time of the client machine. You can customize the display at runtime by configuring the control's Format>Date and Time property. | Use it to set a Calendar control's properties. See Configure the Set a Control's Properties Action |
Current Date | Today's date without the time, for example 2018-09-03. This is the date of the client machine. You can customize the display at runtime by configuring the control's Format>Date and Time property. |
Use it to set a Calendar control's properties. See Configure the Set a Control's Properties Action |
Current Time | The current time without the date, for example 16:50:35.346. This is the time of the client machine. You can customize the display at runtime by configuring the control's Format>Date and Time property. |
Use it to set a Calendar control's properties. See Configure the Set a Control's Properties Action |
Current User | ||
FQN | Fully Qualified Name - A combination of the label and user name, for example K2:domain\user1 | Use this to display the user who is currently using the SmartForm. If you want to use the Current User FQN for auditing or security purposes in a SmartObject, see Advanced SmartObjects: Methods and Sending Identity Information to a Line of Business System |
Display Name | The user's display name, for example User Number 1 | Use it to set a Text Box control's properties to show the user's display name. See Configure the Set a Control's Properties Action and How to: retrieve user details in a form and a workflow |
Name | The user's name, for example user1 | Use it to set a Text Box control's properties to show the user's name. See Configure the Set a Control's Properties Action |
Description | Description of the current user, for example "This user name is used for automation testing" | Use it to set a Text Box control's properties to show a description for the current user. See Configure the Set a Control's Properties Action |
The user's email address, for example user1@domain.com | Use it with a send an e-mail rule action. When you action a worklist item, then send an e-mail as confirmation. See How to: retrieve user details in a form and a workflow | |
Manager | The fully qualified name of the user's manager | Use it to set a Text Box control's properties to show the manager's name of the current user. See Configure the Set a Control's Properties Action |
Client | ||
Screen Height | The screen resolution (height) of the window when you open a view, form, subview or subform, for example 1080. The screen resolution does not change when you shrink or resize the window. See Properties for the view and form properties and the following topics for how to set a view or form's properties: | You can use this system information if necessary, however it is recommended to use a custom theme to change the look and responsiveness of your views and forms. See Custom Themes for more information |
Screen Width | The screen resolution (width) of the window when you open a view, form, subview or subform, for example 1920. The screen resolution does not change when you shrink or resize the window. See Properties for the view and form properties and the following topics for how to set a view or form's properties: |
You can use this system information if necessary, however it is recommended to use a custom theme to change the look and responsiveness of your views and forms. See Custom Themes for more information |
Platform | The platform of the browser, for example Win32, see Navigator platform Property | You can use this system information if necessary, however it is recommended to use a custom theme to change the look and responsiveness of your views and forms. See Custom Themes for more information |
User Agent | The user agent string. See User Agent for more information | Use this field to determine which browser the user is currently using |
Browser Culture | The browser culture of the Client such as en-US (English - United States) or de-DE (German) | Use this field to decide what to show and hide on a form, for example if the browser culture is English, then show the English view and hide the German view |
Error | ||
Message | Error message (summary) for example (Unable to create the object. An object with the specified key property(s) already exist). You can use it for error logging with rule events and actions. This allows you to specify custom rule actions and conditions to be followed, while using error system values such as error message, detail and type. |
Configure a Custom Error Rule |
Details | Error details (detailed content) for example ( at SourceCode.SmartObjects.Client.SmartObjectClientServer.ExecuteScala…). You can use it for error logging with rule events and actions. This allows you to specify custom rule actions and conditions to be followed, while using error system values such as error message, detail and type. |
Configure a Custom Error Rule |
Type | Error type (type of exception) for example (SourceCode.SmartObjects.Client.SmartObjectException). You can use it for error logging with rule events and actions. This allows you to specify custom rule actions and conditions to be followed, while using error system values such as error message, detail and type. |
|
Workflow View | ||
Activity - Full Name | The full name of a workflow activity when you integrate a form with a workflow. This field returns the FQN name for the current workflow activity that you open for example (folder\processname\activityname) | Use it with a send an e-mail rule action. When you action a worklist item, then send an e-mail as confirmation |
Activity -Display Name | The display name of a workflow activity when you integrate a form with a workflow. This field returns the display name for the workflow activity that you open for example (send mail to manager) | Use it with a send an e-mail rule action. When you action a worklist item, then send an e-mail as confirmation |
Controls - Action | The workflow action when you integrate a form with a workflow. This field returns the action that is currently selected in the action drop-down in the workflow strip. Use this to set the Action of the worklist item | Manually Integrating Forms with Workflows Using Rule Actions |
Mode |
A condition indicating if a view or form is in Normal or Offline mode. One example is where the device is offline when opening the form in the K2 Workspace (Mobile) app, you can send a message to inform the user of the offline status. This field returns "offline" when it is in Offline mode and "" when it is in Normal mode. |
Configure Mode Conditions |
Parameters | ||
Parameters | Parameters used on the view or form. Use this to set up actions on the change of a parameter rather than use hidden text boxes on views and forms | |
Controls | ||
Controls | Controls used on the view or form | |
SmartObject | ||
[Quote] | The fields of the SmartObject linked to the view or form. Use the SmartObject fields to set items such as a form parameter | |
Expressions | ||
See the following topics for information on how to use Context Browser items when configuring an expression: |
- Not all values from the Context Browser are available when you configure server-side rules, such as Client and Mode values.
-
Workflow Export rights are required when interacting with any workflow rule conditions or actions. See Server Rights for more information about assigning export rights.