Create Variables

Purpose

To create a new variable in CRM.

Request URL

https://www.zohoapis.com/crm/v2/settings/variables

Request Method

POST

Scope

scope=ZohoCRM.settings.variables.{operation_type}

 
Possible operation types
ALL - Full access to variable data
CREATE - Create variable data

Attributes Specifications

To create variables, send a POST request with request body containing the following attributes:

Key NameTypeDescriptionExampleMandatory
nameTextThis is the display name of the variable that is going to be created. It is a unique field.VariableName3Yes
api_nameTextThis is the name with which the variable is to be referred in any API request. It is a unique field.MainVariableYes
typeTextThis is the data type of the variable.IntegerNo
variable_groupJSON ObjectThis is the group to which the variable should belong to.{"id": 40000000047005} or {"name":"Group2"}Yes
valueDepends on the type of the variable.This is the initial value given to the variable.123No
descriptionTextA short description of the variable.A short description of the variable.No

Note:

  • Variable data type cannot be changed after its creation.

  • Variable Groups can be created only when creating Variables.

  • When creating a variable, if the variable group specified exists already, the variable is simply added to the group.

  • If the variable group specified does not exist, a new group is created, to which the variable is added.

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v2/settings/variables"
-X POST
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"

Sample Input

Copied{
    "variables": [
       {
            "name": "Variable33",
            "api_name": "Variable33",
            "variable_group": {
                "id": "40000000047005"
            },
            "type": "integer",
            "value": 33,
            "description": "This denotes variable 3 description"
        },
       {
            "name": "Variable44",
            "api_name": "Variable44",
            "variable_group": {
                "name": "Group2"
            },
            "type": "text",
            "value": "Hello",
            "description": "This denotes variable 4 description"
        }
    ]
}

Sample Response

Copied{
    "variables": [
       {
            "code": "SUCCESS",
            "details": {
                "id": "40000000047009"
            },
            "message": "variable added",
            "status": "success"
        },
       {
            "code": "SUCCESS",
            "details": {
                "id": "40000000047010"
            },
            "message": "variable added",
            "status": "success"
        }
    ]
}