From ForcePanda: The first Invocable Action that can perform SOQL on any kind of input
Narender builds on his “world’s first” blog post on invocable actions that use the new Spring ’20 generic SObject support with a new post that shows, for the first time, an action that carries out SOQL and can be used declaratively in any object scenario.
The heart of his action is this line:
string query = 'Select '+ queryParams[0].fieldsToQuery + ' FROM ' + queryParams[0].objectApiName + ' LIMIT ' + queryParams[0].numberOfRecords;
As you can see, that’s a SOQL query. Now you’ve always been able to do that with a Flow invocable action, but you always have had to get into the Apex code and specify the exact object you wanted to use. For example, when I posted this tutorial on injecting advanced soql into flows, you can see that my code specifically declared User and Contact variables.
But Narender’s code doesn’t have to do that. And that means that you can take his action and deploy it declaratively against any kind of input.
ForcePanda’s example, powerful though it is, only scratches at the surface of the powerful SOQL actions that will be packaged up into building blocks once Spring ’20 ships. And eventually, we’ll start seeing those actions with friendly configuration UI’s, powered by Custom Property Editors.
