function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jim DelaneyJim Delaney 

Can Process Builder get the id of the record that fired off the Process?

Greetings, 
I have a Process with the criteria that starts the Process when a OpportunityLineItem record is created.  I want to be able to capture that id of that record and pass it on to an apex job.  Is the possible?
Kenneth RayKenneth Ray
Yelp, See below. 
  1. In your apex class, the method needs the "@InvocableMethod" keyword. Also, the method needs to take a "record Id" or a LIST of IDs as the parameter. NOTE: It's best to bulkify you class, so pass the LIST of IDs instead. 
  2. Create an "Apex Action" within process builder.
  3. Under "Apex Class", select/enter the class from step#1.
  4. Under "Set Apex Variables", Select the parameter name from step#1 as the "Field", Reference as the "Type", and  "OpportunityLineItem.Id" as the Value. 
Now anytime the process is triggered, the process will pass the record Id or list of Ids to the apex class. I hope this helps.