Symptom
This document provides guidance on how to sort custom fields in a GET API call for SAP Sales and Service Cloud Version 2.
Environment
- SAP Sales Cloud Version 2
- SAP Service Cloud Version 2
Reproducing the Issue
- Click on the User Icon.
- Go to the Settings > All Settings.
- Go to the Extensibility Administration.
- Select an Entity (e.g. Account, Opportunity, Case etc.).
- Go to the Custom Fields tab.
- Create a Custom Field (e.g. ABC custom field).
Now, you want to retrieve it in a GET API call.
Resolution
First you need to ensure that the Custom Field has "sortable" property set as "true". You need to navigate to Extensibility Administration and then navigate to the Field Attributes tab. Ensure that the "sortable" property is set as "true".
Once verified, you can proceed with formulating the GET API call. Include the following syntax in your API GET request to sort by the custom field:
$orderby=extensions/ZABC%20asc
Example with the Case Service:
https://< Tenant URL >/sap/c4c/api/v1/case-service/cases?$orderby=extensions/<Custom Field Name>%20asc
Make sure to replace "ZABC" with the actual name of your custom field. Following these steps ensures that your API call effectively retrieves and sorts the desired data, streamlining your data management processes.
See Also
Keywords
sorting fields, sort custom fields, sort, sortable, custom fields, api, sorting into api , KBA , CEC-CRM-CZM-EXT , Extensibility for SAP Sales/Service Cloud , How To