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?
Thanks!