You need to sign in to do that
Don't have an account?
Ryan McLaughlin
How to use sortBy in Analytics api
I am trying to run a report through the analytics api and use the sortBy field as specified here https://developer.salesforce.com/docs/atlas.en-us.api_analytics.meta/api_analytics/sforce_analytics_rest_api_getbasic_reportmetadata.htm
The documentation does not mention how the sortBy field should be formatted, so I have been guessing. Like it says in the Docs "API name of the field on which the report is sorted and the direction of the sort (asc or desc)." I have put in the name of the field and asc seperated by a space. it looks something like this "sortBy":"LEAD_ID asc"
However whenever I put in a value for sortby I get an error back saying "The request body is either invalid or incomplete."
If I remove the sortBy it works fine.
Any help would be appreciated
The documentation does not mention how the sortBy field should be formatted, so I have been guessing. Like it says in the Docs "API name of the field on which the report is sorted and the direction of the sort (asc or desc)." I have put in the name of the field and asc seperated by a space. it looks something like this "sortBy":"LEAD_ID asc"
However whenever I put in a value for sortby I get an error back saying "The request body is either invalid or incomplete."
If I remove the sortBy it works fine.
Any help would be appreciated
All Answers
ORDER BY Name ASC
hope that helps :D
I also find it interesting that in the above link sortBy is labeled as a string, but in some code examples https://resources.docs.salesforce.com/sfdc/pdf/salesforce_analytics_rest_api.pdf (https://resources.docs.salesforce.com/sfdc/pdf/salesforce_analytics_rest_api.pdf" target="_blank) sortBy is shown as an array