We have a web-based form that customers fill out and the data gets saved in a custom object called Book Requests. When the Book Request Record is saved, Process Builder generates the Account (always new) and Contacts (can generate as many as 3 new contacts). The Book Request Name is saved on both the Account record and the Contact record. Is there any way to "copy" the Account Name (Account Object) to Account the lookup field on the Contact? I've tried modifying a couple of different flows with out any success. I'm keeping my fingers crossed there is any easier way.
1 Answer
Process Builder does not provide the capability to store values (the Id of the created Account) and use them across different Actions (the action to create Contacts). To do that, you'd need to use Flows.
In Flow Builder, you do have the freedom to design sequences of dependent actions and to store state - the information you'd need from the outcome of Action A to successfully execute Action B.
Your Process Builder would have only one action, which would launch your Flow. Your Flow would start with a Create Records element to create the Account, which I'd think would look something like this:
Thereafter, you'd have to draw out your logic to create one or more Contacts. I'm depicting this here for a single Contact; your final Flow would probably build up a collection variable and then create them in one operation.
Note how the AccountId
field is populated using the accountId
variable, which was created upon the creation of the original Account.
Your final Flow would end up more complex than this one, because you'd have some type of conditional logic between your Account and Contact creation steps, but you'd still have those core sObject creation steps present.
AccountId
field on the created Contact.