Change Sort Order of Custom Views
Purpose
To modify the sorting order of records within a custom view.
Endpoints
- PUT /settings/custom_views/{custom_view_ID}/actions/change_sort?module={module_API_name}
- PUT /settings/custom_views/actions/change_sort?module={module_API_name}
Request Details
Request URL
To modify sorting order of records of a specific custom view:
{api-domain}/crm/{version}/settings/custom_views/{custom_view_ID}/actions/change_sort?module={module_API_name}
To modify sorting order of records of multiple custom views:
{api-domain}/crm/{version}/settings/custom_views/actions/change_sort?module={module_API_name}
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
Scope
ZohoCRM.settings.custom_views.{operation_type}
(or)
ZohoCRM.settings.ALL
Possible operation types
ALL - Full access to custom views module
UPDATE - Update custom views
Parameters
- modulestring, mandatorySpecify the module API name. Use the GET Module Metadata API to get the module API names. 
Input JSON Keys
- sort_byJSON object, mandatoryThe api name and ID of the field by which you want to sort the records. 
- sort_orderstring, mandatoryThe order by which you want to sort the records. 
 Possible values :
 asc : ascending order
 desc : descending order
Note
You can update up to 100 custom views in a single API call.
Sample Request to sort a single Custom View
Copiedcurl "https://www.zohoapis.com/crm/v8/settings/custom_views/1306462000000505004/actions/change_sort?module=Leads"
-X PUT
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"Sample Input
Copied{
    "custom_views": [
        {
            "sort_by": {
                "api_name": "Email",
                "id" : "1306462000000000563"
            },
            "sort_order": "asc"
        }
    ]
}Sample Response
Copied{
    "custom_views": [
        {
            "code": "SUCCESS",
            "details": {
                "id": "1306462000000505004"
            },
            "message": "custom view updated",
            "status": "success"
        }
    ]
}Possible Errors
- INVALID_REQUEST_METHODHTTP 400The http request method type is not a valid one 
 Resolution: You have specified an invalid HTTP method to access the API URL. Specify a valid request method. Refer to endpoints section above.
- INVALID_DATAHTTP 400- Invalid Custom View ID
 Resolution:Ensure that you specify a valid custom view ID in the request URL.
- Invalid API Name and ID for sort_by key
 Resolution: Confirm that the API name and ID provided for the sort_by key in the input JSON are correct.
- Invalid Sort Order Key
 Resolution: Check that the value assigned to the sort_order key is correct. Valid values are "asc and "desc"
 
- Invalid Custom View ID
- INVALID_MODULEHTTP 400The module name given seems to be invalid 
 Resolution: Specify a valid module name in the request URL.
- MANDATORY_NOT_FOUNDHTTP 400Required field not found 
 Resolution: You have not specified a mandatory key in the input body. Specify all the mandatory keys.
- OAUTH_SCOPE_MISMATCHHTTP 401Unauthorized 
 Resolution: Client does not have the required OAUTH SCOPE. Create a new client with valid scope. Refer to scope section above for more details.
- INVALID_URL_PATTERNHTTP 404Please check if the URL trying to access is a correct one 
 Resolution: The request URL specified is incorrect. Specify a valid request URL. Refer to Request URL section above.
- INTERNAL_ERRORHTTP 500Internal Server Error 
 Resolution: Unexpected and unhandled exception in Server. Contact support team.
Sample Request for multiple Custom Views
Copiedcurl "https://www.zohoapis.com/crm/v8/settings/custom_views/actions/change_sort?module=Leads"
-X PUT
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"Sample Input for multiple Custom Views
Copied{
   "custom_views":[
      {
         "sort_by":{
            "api_name":"Email",
            "id":"1306462000000000563"
         },
         "sort_order":"desc",
         "id":"1306462000000505004"
      },
      {
         "sort_by":{
            "api_name":"Company",
            "id":"1306462000000000555"
         },
         "sort_order":"asc",
         "id":"1306462000000091501"
      }
   ]
}Sample Output for multiple Custom Views
Copied{
    "custom_views": [
        {
            "code": "SUCCESS",
            "details": {
                "id": "1306462000000505004"
            },
            "message": "custom view updated",
            "status": "success"
        },
        {
            "code": "SUCCESS",
            "details": {
                "id": "1306462000000091501"
            },
            "message": "custom view updated",
            "status": "success"
        }
    ]
}