0

I have a process in the process builder that runs whenever a record from a certain object is modified. I need to take the id of the record that was modified and pass that to the Invocable method that is called by the process.

In the action box of process builder ,there's a section Set Apex Variables where variables for the apex class can be set. In this case, the section would only cover the functionality of sending data to the apex class whereas the issue here deals with sending data from a row in an sObject (that was either created or deleted) to process where it can then be sent to the class. What would be the best way to go about doing this?

1 Answer 1

2

If you're already passing the record Id to the Apex class, you don't need to set Apex variables with the record's data. The Apex method should requery the record to get all the fields it needs. This is better than passing each field as a separate data point, since that will get cumbersome quickly.

2
  • I don't yet actually have the code to send the record id to the class. What I was trying to do is figure out a way to call a class method and pass it the id of the record that was just operated on (create or delete) and it seemed like this would be done via process builder. The issue is, the create or delete will be done by the user in the Salesforce interface, thus triggering the process so I don't know how the the id would even get to the class. Mar 19, 2018 at 20:35
  • Process Builder does not fire on record deletion, so you might as well do everything in Apex triggers since you were planning to do some Apex processing already. Regarding record creation/update: Process Builder will have the Id of the record Id that triggered it, so that is what you pass to the Apex class. Example: if you insert a contact, then in Process Builder the Id is Contact.Id. Mar 19, 2018 at 20:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .