In my Process Builder, on creation of my custom Object Bank__c record, I want to pass two parameters(Ids, objectApIName) to InvocableMethod in Apex class, so I added this to my code,
public static List<Id> idList = new List<Id>();
public class Request{
@InvocableVariable(required=true)
public List<Id> ids;
@InvocableVariable(required=true)
public String objectAPIName;
}
@InvocableMethod
public static void mergeAccounts(Request[] requests) {
String objectAPIName; // Object API Name
for (Request mp : requests) {
idList.addAll(mp.ids);
objectAPIName = mp.objectAPIName;
}
---
---
}
But when I am trying to add "ids" variable with RecordId in Process Builder it is giving me this error
"The input parameter "ids" can accept multiple values, so the assigned value must be a flow variable with the isCollection property set to true."
Is there any way I can pass the RecordId's into my Apex class just from PB instead of also using Flow. Let me know.
Thank you!
Best Answer
You can't. You'd have to change the variable to
Id
instead ofList<Id>
.