All Products
Document Center

Create and run a policy

Last Updated: Jul 22, 2021

Description: A policy defines the computing logic that you orchestrate to check requests in your business. When a request is received, the decision engine checks the request based on the preset policies. If the computing logic of a policy is hit, the preset tag of the policy is returned.

Scenario: If you need complex computing logic, you can configure a policy with a set of rules. For example, if you need to recognize high-risk borrowers during loan approval, you can check whether the mobile numbers, email addresses, and accounts of borrowers are in the blacklist. If the mobile number, email address, or account of a borrower is in the blacklist, the borrower is considered high risk. You can configure a policy in Fraud Detection to implement the preceding logic.

1. Log on to the Fraud Detection console and go to the Policies page. On the Policies page, click Create Policy.

2. On the Create Policy page, set basic parameters for the policy.

Note: Variables are associated with events. If you have any misoperations, variables may become unavailable, which affects policy computing. To avoid this, the system does not allow you to modify the associated event of a policy after the policy is created.

3. Configure the computing logic of the policy.

This section describes how to configure a rule for the computing logic. Set Rule Name. This field is optional. We recommend that you set a name that can reflect the logic to help you understand the rule. Click the box of the left variable. In the Left Object pane, select a variable. For example, you can select a system variable, a field from the associated event, or a custom variable. Then, click OK.

Select an operator to check the value of the left variable. The system provides applicable operators based on the data type of the left variable. For example, if the left variable is a string, operators including >, <, and = are unavailable.

After you select a left variable and an operator, click the box of the right variable. In the Right Object pane, you can click the Right Object tab to enter a variable, or click the Select Variable tab to select a variable.

Note: If you select an event field as the left variable in the Left Object pane, you can select a function to compute the event field. For example, if you need to calculate the number of characters of the mobile field, choose Fields from Event > mobile > Calculating number of characters. It is optional to select a function for an event field. For example, you can choose Fields from Event > mobile. In this case, you do not perform function computing on the mobile field.

To configure multiple rules to implement the computing logic of the current policy, click Add Rule to add a rule. You can also copy and modify a rule as required to create a new rule with similar logic.

4. Orchestrate and preview the computing logic.

You can use the sequence numbers of rules and logical operators to orchestrate the logic. Available logical operators are |, &, and (), where, | indicates OR and & indicates AND. After you complete the orchestration, click View Rule Tree to preview the computing logic. The system displays the names of rules based on their sequence numbers. If you do not set the name for a rule, the system displays the sequence number of the rule.

Note: To avoid logic chaos caused by multiple negation, the NOT operator ! is not supported. To perform the NOT operation, change the operator to the opposite one for the target rule. For example, change NULL to IS NOT NULL.

5. Set the output tag and status for the policy.

The output tag specifies the content returned by the decision engine when the computing logic of the policy that you created in Step 3 and Step 4 is hit. We recommend that you set an output tag that is easy to understand, such as highRisk or pass. If you set multiple output tags, separate them with commas (,). If multiple policies that are associated with an event use the same output tag, the decision engine returns unique tags by removing the duplicate ones.

You can set a policy to one of the following states: Draft, Test, and Run. A policy in the Draft state is saved but does not run. A policy in the Test state is saved and runs normally, but does not return output tags. A policy in the Run state is saved, runs normally, and returns output tags when its computing logic is hit. We recommend that you set a policy to the Test state to ensure proper running before you set it to the Run state. This can reduce risks caused by misoperations.


Is saved

Is running

Returns output tags







After you submit a policy, the policy takes effect in 2 minutes. To continue to create another policy after you submit the current one, click Save and Create Another Policy.

6. Obtain the computing result of the policy.

After you create an event, add the event to the decision engine, and associate a policy with the event, you can send a request to the API endpoint of the decision engine. If the request hits the computing logic of the policy associated with the event, the decision engine returns the output tag of the policy. The following figure shows an example. The tags parameter in the response indicates the output tag of the policy that your request hits.Result