I'm working on some functionality that calls some standard invocable actions via Salesforce's REST API (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_actions_invocable_standard.htm). I'm providing a list of inputs to an end user, then I make the call to the invocable action with the values the user provides for these inputs.

I'd like to build this list of inputs dynamically, based on Salesforce's current API. Therefore, I'm currently using the response from the standard action's endpoint to get the expected inputs. For example, for the "Submit for Approval" action, I make a call to m/services/data/v42.0/actions/standard/submit, which returns a description of the action in the response, including a list of the expected inputs. I then use the list of inputs from the JSON response to build inputs for the user.

The problem I'm encountering is, it looks like some of these inputs expect an "array", but I don't see any indicator from the initial response that these inputs accept an array. For example, compare the description of the objectId input (which expects a string) with that of the nextApproverId input (which expects an array):

inputs: {
    0: {
        byteLength: 18,
        description: "Required. The ID of the record being submitted for approval.",
        label: "Record ID",
        maxOccurs: 1,
        name: "objectId",
        picklistValues: null,
        required: true,
        sobjectType: null,
        type: "REFERENCE",
    3: {
        byteLength: 0,
        description: ""Optional. An array of one ID of the next approver, which can be a user or a group. Optional since some approval processes have the next approver(s) specified in the approval process definition.",
        label: "Next Approver IDs",
        maxOccurs: 2000,
        name: "nextApproverIds",
        picklistValues: null,
        required: false,
        sobjectType: null,
        type: "REFERENCE",

While the description for the nextApproverIds input indicates that it expects an array, there's no actual parameter that indicates this (the type for both inputs is "REFERENCE"). Therefore, I can't dynamically determine how to format the call to this action. Has anyone encountered this? Do you know of a workaround for this issue?


  • Is your question as how do you identify if an input expects array vs. a single element? – Jayant Das Dec 10 '18 at 17:32

If I understand your question, you are looking for a way to identify if an input is array or not.

While the description for the nextApproverIds input indicates that it expects an array, there's no actual parameter that indicates this

In fact, there is an attribute maxOccurs, that determines if an element is expected more than once. You can use it to to identify if you need to pass an array. This attribute, if declared with the value of 1 would mean it expects only one parameter, anything more than 1 can be treated as an array. You can find more details on this attribute on XML Occurrence Constraints.

The maximum number of times an element may appear is determined by the value of a maxOccurs attribute in its declaration

  • 1
    Yes, Jayant, that's what I'm looking for. I was not sure what the maxOccurs attribute was for, but it looks like that might solve my problem! Thanks for the input. – Emily Davis Dec 10 '18 at 19:37

Not the best way, but you can see the type in the description field.

enter image description here

If description contains keyword "Array" its an array

  • Thanks Pranay, but I'd really rather not rely on the description, since that's not really a reliable way to know that an input expects an array. – Emily Davis Dec 10 '18 at 18:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.