Execute Scoring Rules
The Execute Scoring Rules API enables developers to execute scoring rules on different modules, ensuring that scores are calculated and records are updated according to the defined criteria in the scoring rules.
Scoring rules can be executed in two ways: by specifying individual scoring rule IDs or by using a layout ID. When executing by scoring rule IDs, all specified rules must correspond to the same module. Conversely, if you execute by layout ID, all active scoring rules associated with that layout will be applied. If no request body is provided, the API will schedule execution for all active rules related to the specified module. The rules will be applied to records that have been created or have had activity within the last six months.
Purpose
To execute scoring rules for a specific module within the Zoho CRM organization.
Endpoints
- PUT /{module_api_name}/actions/run_scoring_rules
Request Details
Request URL
{api-domain}/crm/{version}/{module_api_name}/actions/run_scoring_rules
Supported modules
Leads, Accounts, Contacts, Deals and Custom
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
Scope
ZohoCRM.settings.scoring_rules.ALL
(or)
ZohoCRM.settings.scoring_rules.{operation_type}
Possible operation types
ALL - Full access to scoring rules
Update - Execute scoring rules
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v8/Leads/actions/run_scoring_rules"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-X PUT
-d @executerules.json
Note
If no request body is provided, the API will schedule execution for all the active scoring rules associated with all layouts related to the specified module.
Scoring Rule execution using Rule IDs
Scoring rules can be scheduled for execution by specifying their unique scoring rule IDs. When using this method, all scoring rules belong to the same module. You can execute up to five active scoring rules at a time using this method.
Input JSON
- scoring_rulesJSON array, mandatory
Represents the unique IDs of the scoring rules to be executed.
Sample Input
Copied{
"scoring_rules" : [
"4876876000000965604",
"4876876000000945002"
]
}
Scoring Rule execution using Layout ID
To schedule the execution of all active scoring rules associated with a specific layout within a module, you can specify the layout ID in the input body.
Input JSON
- layoutJSON object, mandatory
Represents the unique ID of the of the layout for which the scoring rules are to be executed.
Sample Input
Copied{
"layout" : {
"id" :"4876876000000091055"
}
}
Possible Errors
- INVALID_REQUEST_METHODHTTP 400
The request method is incorrect.
Resolution: Use the HTTP PUT method to make this API call. Any other request method will result in this error. - AMBIGUITY_DURING_PROCESSINGHTTP 400
You have specified both Layout ID and Scoring Rule ID in the input body.
Resolution: Specify either the layout ID or Scoring Rule IDs to be executed. - INVALID_DATAHTTP 400
Scoring Rule ID or Layout ID seems to be invalid
Resolution: Please specify valid rule ID or layout ID for execution. - INVALID_DATAHTTP 400
Module name seems to be invalid
Resolution: Please specify a valid and supported module name in the request URL. - INVALID_DATAHTTP 400
Given ID does not belong the specified module
Resolution: Specify Scoring Rules corresponding to the specified module. - INVALID_DATAHTTP 400
More than five active scoring rules are given for execution
Resolution: Limit the number of rules to be executed to 5 when executing by Rule IDs. - CANNOT_PERFORM_ACTIONHTTP 400
The specified module has no Scoring Rules for any layout
Resolution: Please create Scoring Rules or specify another valid module. - OAUTH_SCOPE_MISMATCHHTTP 401
The access token you have used to make this API call does not have the required scope.
Resolution: Generate a new access token with the required scopes for this API. Refer to the Scope section at the beginning of this page for the list of required scopes. - NO_PERMISSIONHTTP 403
You do not have permission to execute scoring rules.
Resolution: The user does not have permission to execute scoring rules. Contact your system administrator. - INVALID_URL_PATTERNHTTP 404
The request URL is incorrect.
Resolution: Specify a valid request URL. Refer to the request URL section at the beginning of this page for more details. - INTERNAL_ERRORHTTP 500
Unexpected and unhandled exception in the server.
Resolution: Contact the support team at support@zohocrm.com.
Sample Response
CopiedExecution by Scoring Rule IDs:
{
"scoring_rules": [
{
"code": "SCHEDULED",
"details": {
"job_id": "4876876000000984013"
},
"message": "scoring rules successfully scheduled to run",
"status": "success"
},
{
"code": "SCHEDULED",
"details": {
"job_id": "4876876000000984013"
},
"message": "scoring rules successfully scheduled to run",
"status": "success"
}
]
}
Execution by Layout ID:
{
"code": "SCHEDULED",
"details": {
"job_id": "4876876000000984011"
},
"message": "The scoring rules of the specified layout successfully scheduled to run",
"status": "success"
}