Change Sort Order of Custom Views

Purpose

To change the sort order of records in a custom view.

Request Details

Request URL

{api-domain}/crm/{version}/settings/custom_views/{cv-id}/actions/change_sort?module={module_name}

For multiple custom views:
{api-domain}/crm/{version}/settings/custom_views/actions/change_sort?module={module_name}

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

Scope

scope=ZohoCRM.settings.custom_views.{operation_type}
(or)
scope=ZohoCRM.settings.ALL

Possible operation types

ALL - Full access to custom views module
UPDATE - Update custom views

Input JSON Keys

  • sort_byJSON object, mandatory

    The api name and id of the field by which you want to sort the records.

  • sort_orderstring, mandatory

    The order by which you want to sort the records. The possible values are :
    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/v6/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_URL_PATTERNHTTP 404

    Please 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.

  • OAUTH_SCOPE_MISMATCHHTTP 401

    Unauthorized
    Resolution: Client does not have the required OAUTH SCOPE. Create a new client with valid scope. Refer to scope section above for more details.

  • INTERNAL_ERRORHTTP 500

    Internal Server Error
    Resolution: Unexpected and unhandled exception in Server. Contact support team.

  • INVALID_REQUEST_METHODHTTP 400

    The 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 data
    Resolution: Specify a valid custom view ID in the request URL, and valid API name and ID for the sort_by key. Check if you have given the correct value for the sort_order key.

  • INVALID_MODULEHTTP 400

    The module name given seems to be invalid
    Resolution: Specify a valid module name in the request URL.

  • MANDATORY_NOT_FOUNDHTTP 400

    Required field not found
    Resolution: You have not specified a mandatory key in the input body. Specify all the mandatory keys.

Sample Request for multiple Custom Views

Copiedcurl "https://www.zohoapis.com/crm/v6/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"
        }
    ]
}