Introduction
This process uses a Try block in a Logical Rule. This handles runtime exceptions to prevent your app from crashing.
A try block contains a block of code that might raise an exception. If an exception occurs, the app will execute the nearest catch block. When the app is finished executing any catch blocks, it executes the finally block to close any resources opened in the try block.
You can add a try block to any new or existing rule. This example creates a new rule and designs it with the try block.
Prerequisites
The entity must exist.
|
Quick Steps |
| 1 |
Click the Create New Item icon, then select the Object Type |
| 2 |
Select the Rule Type |
| 3 |
Enter the details, then click OK |
| 4 |
Design the rule |
| 5 |
Enter the Description and Expression for each component |
| 6 |
Declare any variables |
| 7 |
Save and compile the rule |
| 8 |
Open the scenario, then open the test case |
| 9 |
Enter the values and run the test |
| 10 |
View the result diagram |
Detailed Steps
Step 1. Click the Create New Item icon, select the Object Type, then select the Rule Type.
This opens a dropdown list from which you can select an object to begin its item wizard. The item wizard creates a file or files.
The Object Type identifies the file the wizard will create. In this case, it is Rule.
Step 2. Select the Rule Type.
The Rule Type identify the file the wizard will create. This example creates a Logical Rule.
Step 3. Enter the details, then click OK.
Enter the following properties:
- Entity: The rule is based on the entity. The fields available to the rule will be based on this entity's attributes.
- Name (ID): This is the rule's programmatic ID. This property is required. The ID must be unique, and it cannot start with numbers.
- Access Modifier: Specifies the level of accessibility of the rule.
- Return Type: This is the data type of the result you expect the rule to return (string, int, etc.).
- Is Collection: This is available when the logical rule returns a result. If checked, the rule can return a collection.
- Static: If checked, the rule will be available to call from anywhere. Otherwise, you will have to call it from an instance of its object. A logical rule can directly use the entity attributes if it is not static.
- Allow From Platform Api: If checked, the rule will be available from Platform API.
- Trace: Making a rule traceable means you can view the path and result every time the code executes that rule.
- Description: Optionally, you can enter a short description for your rule.
The Access Specifier options are:
Public: The rule is accessible from anywhere.
Private: The rule is accessible only from the current entity rules.
Protected: The rule is accessible only from this entity and any child entity.
What are the improvements over S3 Version 6?
This is a new process.
Related Articles
Create and Test a Logical Rule with One Condition
Create and Test a Logical Rule with a Loop and Call to a Decision Table
Logical Rule Elements
This post is part of the Rules topic. Click here to open the Rules Overview.
#Xelence
#Rules