Update Scoring Rules
Purpose
To update various attributes of existing scoring rules in your Zoho CRM organization, such as their names, description and rules.
Endpoints
- PUT /settings/automation/scoring_rules
- PUT /settings/automation/scoring_rules/{rule_ID}
Request Details
Request URL
{api-domain}/crm/{version}/settings/automation/scoring_rules
To update a specific scoring rule:
{api-domain}/crm/{version}/settings/automation/scoring_rules/{rule_ID}
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 - Update scoring rules
Note
- The name and description of a scoring rule can be updated using the API. It is also possible to add new field and signal rules, as well as update or delete existing field rules and signal rules.
- Any keys related to module, layout, or status included in the input body will be ignored and cannot be updated. This means you cannot change the module or layout the scoring rule is assocaited with, nor can you modify its active or inactive status using this API.
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v8/settings/automation/scoring_rules"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-d @updaterules.json
-X PUT
Input JSON
- idstring, mandatory
Represents the unique ID of the rule to be updated.
- namestring, optional
Represents the unique name of the scoring rule. The maximum possible length for this field is 25 characters.
- descriptionstring, optional
Represents the description of the rule. The maximum possible length for this field is 500 characters.
- field_rulesJSON array, optional
Represents the field rules for the scoring rule.
- scorenumber, optional
Represents the score assigned for the specific rule. The value of this keys ranges from -100 to 100.
- criteriaJSON object, optional
Represents the criteria details, including:
- group_operatorstring, optional
The logical operator used to combine criteria. Possible values are and or or.
- groupJSON array, optional
An array of criteria objects that define the conditions for scoring. Each criterion must include:
- fieldJSON object, optional
Specify the field being evaluated.
- comparator stringstring, mandatory
The comparison operator. The supported operators are equals, starts_with, in, not_equal, greater_equal, greater_than, less_equal, less_than and between.
- valuestring, mandatory
The value to compare the field value against.
- signal_rulesJSON array, optional
Signal rules defined for the scoring rule. Each signal rule must include:
- scorenumber, optional
The score assigned to this signal rule. The value of this keys ranges from -100 to 100.
- signalJSON object, optional
Represents the signal details. You can get the signal details using the Signals API.
- namespacestring, optional
The namespace of the signal.
- idstring, optional
The unique identifier for the signal.
- custom_fieldsJSON array, optional
An array of custom field objects that allow users to create new fields or map scores to existing fields in records. Each custom field includes:
- field_labelstring, optional
The label for the custom field as it will appear in the user interface. If you want to use an exisiting field, use the field label of the corresponding field.
- reference_fieldJSON object, optional
To map the custom field to a specific score.
- api_namestring, optional
The API name of the score that you want to map. The possible values are Positive_Score, Negative_Score, Touch_Point_Score, Touch_Point_Positive_Score, Touch_Point_Negative_Score and Score.
Note
To delete a field rule, signal rule or a custom field, include the _delete key in the respective array in the input JSON, specifying the ID of the rule or the custom field you wish to remove. Please refer to the Sample Input section for more details.
Sample Input
Copied{
"scoring_rules": [
{
"name": "Leads Rule Test",
"id": "4876876000000945002",
"description": "SR for Leads",
"field_rules": [
{
"score": 5,
"criteria": {
"group_operator": "or",
"group": [
{
"group_operator": "AND",
"group": [
{
"field": {
"api_name": "Company"
},
"comparator": "equal",
"value": "Villa Margarita"
},
{
"field": {
"api_name": "Phone"
},
"comparator": "equal",
"value": "5555555555"
}
]
},
{
"field": {
"api_name": "Designation"
},
"comparator": "equal",
"value": "review"
}
]
}
},
{
"id": "4876876000009019407",
"score": 7,
"criteria": {
"group_operator": "and",
"group": [
{
"group_operator": "OR",
"group": [
{
"field": {
"api_name": "Company"
},
"comparator": "equal",
"value": "Zylker"
},
{
"field": {
"api_name": "Phone"
},
"comparator": "equal",
"value": "123456890"
}
]
},
{
"field": {
"api_name": "Designation"
},
"comparator": "equal",
"value": "Executive Secretary"
}
]
}
},
{
"id": "4876876000009019427",
"_delete": null
}
],
"signal_rules": [
{
"id": "4876876000009028119",
"score": 8
},
{
"id": "4876876000009028118",
"_delete": null
},
{
"score": -15,
"signal": {
"namespace": "EmailInsight_Bounce__s",
"id": "4876876000000112023"
}
}
],
"custom_fields": [
{
"field_label": "Touchpoint Negative Score",
"reference_field": {
"api_name": "Touch_Point_Positive_Score"
}
},
{
"id": "4876876000009028059",
"_delete": null
}
]
}
]
}
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. - INVALID_DATAHTTP 400
You have either specified a rule name exceeding 25 characters or description exceeding 500 characters
Resolution: Specify the name and description within their respective limits of 25 characters and 500 characters. - MANDATORY_NOT_FOUNDHTTP 400
You have not specified a mandatory field in the input
Resolution: Please specify all mandatory fields. Refer to the input JSON keys section to know more. - DUPLICATE_DATAHTTP 400
A scoring rule with the specified criteria or the same name already exists.
Resolution: A scoring rule with the specified criteria or the same name already exists. Specify a different criterion or name for the rule. - INVALID_DATAHTTP 400
The ID given seems to be invalid
Resolution: You have specified an invalid rule id. Specify valid rule ID in the request body. - ALREADY_USEDHTTP 400
The specified criteria is already given in the same rule under different index.
Resolution: Please specify a different criteria. - NOT_SUPPORTEDHTTP 400
You have specified Signal rules for non-people module. Signal rules are not supported for non-people modules.
Resolution: Use field rules for the specified module. - INVALID_DATAHTTP 400
You have specified an invalid value for the score key
Resolution:Specify a valid value for the key. Please refer to input JSON keys section for more details. - 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 update scoring rules.
Resolution: The user does not have permission to update 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
Internal Server Error
Resolution: Unexpected and unhandled exception in Server. Contact support team.
Sample Response
Copied{
"scoring_rules": [
{
"code": "SUCCESS",
"details": {
"id": "4876876000000945002"
},
"message": "scoring rule updated successfully",
"status": "success"
}
]
}