Is it possible to pass model data to invocable method

  • 2
  • Question
  • Updated 2 years ago
Is it possible to pass model data to an invocable method who's parameter is a List of the SObject type?

For example (taken from https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_Inv...):
public class AccountInsertAction {  @InvocableMethod(label='Insert Accounts' description='Inserts the accounts specified and returns the IDs of the new accounts.')
public static List<ID> insertAccounts(List<Account> accounts) { ... }

I've been able to Expose an Apex Class as a parameter but cannot seem to get concrete SObject Types to work.  Each time I choose the Apex action and then type anything at all in to the parameter value property, the value is not being "saved" (when I click away and click back its gone) and from that point on, changing the Apex Action property to a different action doesn't change the parameter list.  In short, the property viewer basically dies but there is no exception, no error message, etc.

Before I capture all the steps and log the issues, first question is whether or not doing this is even supported?  Outside of a few community posts, I can't find much information on calling Invocable Methods from Skuid (if this exists, can you provide link please?).

Thanks!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb

Posted 3 years ago

  • 2
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
^^bump^^

I've noticed the same issue Barry mentions about the page builder. We've got two Invocable Methods related to Approval Processes, each with a different set of Invocable Variables. Only the variables for the first Method chosen in a picklist show up in the property window in page builder, if you chance to another available invocable method the options for variables do not change. 



Barry - you definitely can post model data into an invocable method, but I wonder what the syntax would be for your list of new accounts, possibly {{$Model.Accounts.data}} ?
(Edited)