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
Dan NorfleetDan Norfleet 

Process Builder Insert Records

I have a need to interagate a field on a parent, and if it is TRUE, do an Update on a child object for those records or Insert if the records are not already there.  Specifically, adding a field to the Product object - boolean indicator.  If that boolean indicator is true for a given product, Insert 3 product Media records automatically (basically give URL's for the different image types for that product).  If records are already there, do update (so basically ability to do an UPSERT).

Can I use a process builder to achieve this?  If so, I do not see an option to insert records, only to update.  

Thanks for any suggestions.  If this can't be done via Process Builder, is Flow or Apex code using a trigger recommended path?

Dan
Best Answer chosen by Dan Norfleet
Raj VakatiRaj Vakati
Create an apex class with InvocableMethod Annotation perfom upsert operation in the class . And call the apex class from the process to perform the upsert

All Answers

pankul guptapankul gupta
Upsert action is not possible via a process builder directly. Else, you can create one more checkbox field which will check if the records are already there or not. Then create a process builder and define the criteria over there, if the checkbox field is checked, update the record else insert the record.

The same can be achieved via Flow even.
Raj VakatiRaj Vakati
Create an apex class with InvocableMethod Annotation perfom upsert operation in the class . And call the apex class from the process to perform the upsert
This was selected as the best answer