Implementing a Call Using a Record-Triggered Flow (Automatic Trigger)
One way to make the callout using a Callout Template is automatically with a Record-Triggered flow. This method is asynchronous. The flow only initializes the callout, the actual callout runs in a different transaction. If you need the transaction to happen in the same transaction, use the synchronous flow action or the screen flow component.
Invoke a callout automatically with a Record-Triggered Flow
To use the Callout Template in a record-triggered flow, you will start by going into Set Up and selecting Flows under Process Automation (be sure to check out Salesforce documentation on Flows as well!). Click “New Flow” and select “Record-Triggered Flow”. Add your object and enter conditions for when the flow is triggered, and make sure to select “Actions and Related Records” when asked “Optimize the Flow for”.
Now, you can add an Action element to the flow. As an Action, search for “Invoke Callout”. You can reference the callout template by using the Template Developer Name or using the Template Id. Using the Developer Name action is recommended because it makes it easier to deploy and doesn’t hardcode record ids into your Salesforce setup.
If you are using the Template Developer Name, you need to provide the Template’s developer name. If you’re using the Template Id, you need to provide the Template’s Id. You can identify your Callout Template Id or Developer Name under the Administration tab, Callout Templates subtab in the Declarative Webhooks app. If there is no Developer Name displayed, it means you are using an older version of the template. To generate the developer name, edit the callout template, save and the developer name will be automatically generated.
After providing a label, name and description, set the Input Values. You have to provide the record Id that is going to be used for this callout. You can use the record that started the flow or a related record.
Be sure to Activate your process and test by either creating or editing a record associated with your Main Object.
We recommend testing this in your Sandbox before Production.
If you want to review the callout logs of the automated process you have created, return to the Declarative Webhooks app and select the Call Logs tab.