Accessing NBA via the Tooling API

The Tooling API provides a way to get information about Action Strategies. I’m more familiar with the Metadata API, but in general Salesforce is trending towards the Tooling API as a more flexible, granular tool, and this is likely to increase. For performance reasons, metadata API deploys and retrieves will often trigger a recompilation of all of an org’s Apex. (This is controlled by a setting in Apex Settings called “Perform Synchronous Compile on Deploy” which is on by default in many orgs). The recompilation can make the mdapi deploy/retrieve too slow for quick data calls of the sort you’d want for your apps. So Tooling API is the way to go.

/services/data/v45.0/tooling/sobjects/RecommendationStrategy/describe

You can provide a recordId and get all the information about the record with:

/services/data/v45.0/tooling/sobjects/RecommendationStrategy/0sgB000000003PcIAI/

This returns a json data structure that’s visualized here in workbench:

To retrieve a list of strategies, use Select query language. For example:

/services/data/v45.0/tooling/query/?q=Select+id,MasterLabel,DeveloperName+from+RecommendationStrategy

As a tip, it is considerably easier to play with this api if you install the Salesforce Workbench Tools for Google Chrome. Just go to a page that’s logged in to your org and then click this button in the toolbar.

1 reply
  1. A Valido
    A Valido says:

    Thank you for the great content. With winter 20 release coming up can you share what will be new for NBA and/or release notes?

    Thanks!

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply