documentation logo
All you’ll ever need to know about Declarative Webhooks and how to get started.

Pages

Step 3: Inbound Template Actions (Old Interface)

Response Actions Section

Here you will define actions based on received call. We have provided you with a guide on how to use these options.

Find/Update Main Record: This is a unique main action for the template. You have the option to identify the main record to be used in this call by matching a field from the Saleforce object with a received JSON node value. This record can be updated or created if not found. If you select any of the create/update actions, you will be able to map further fields from your inbound call body. Furthermore, the main record found (or created) can be used in the next actions.

Create Record: Here you have the option to create a new record, related or unrelated to the main record identified above.. You can select the object type you want to create and choose how it’s related to the main object.

Update Related Record: This option enables you to update a record related to the main record identified above. For example, if Contact was your main object, you can use this to update the Account that the object is related to after the inbound call is made. Similar to the previous options, you have the ability to map fields associated with your related record here.

Upsert Single Record: This option enables you to update a record that can be identified by matching a Salesforce field with a node value. If no record is found, then you have the option to create it.

Create / Update File: This option enables you to create or update a Salesforce Attachment or File (ContentDocument) based on the JSON response. Each file can be identified by matching a Salesforce field with a node value. If no record is found for each list item, then you have the option to create it.

Upsert List of Records: This option enables you to update a list of records based on a list from the JSON response. Each record can be identified by matching a Salesforce field with a node value. If no record is found for each list item, then you have the option to create it.

Run Autolaunched Flow: This feature allows you to utilize the capabilities of an “Autolaunched Flow (No Trigger)” to perform complex calculations and logic beyond basic record insertions and updates.

Run Apex: This option enables you to run an apex class as an inbound action.

 

Find/Update Main Record

Let’s say in this example we want to update an Account record. As we have a Node for account ‘name’ we can use this in our action mapping to identify the account record we want to update. In the dropdown you can select which Salesforce field to search by and which URL parameter or response body node to use as a value.

You can add an additional line with Field – Node matching criteria by clicking “+”. If you add a second one, it’s used as a backup match to identify a record. If the first match doesn’t find anything, the second match will be attempted.

Now that we have mapped WHAT account we want to update (via Account Name) our next step is to check ‘Update main record: Account’ to true so we can map what fields we would like to update on the account record:

Select the ‘Add Field’ button to map fields to update on your account record. In the Type dropdown you have the following options:

  • If you choose Static Value, the field will be updated with that exact value every time the inbound call is made.
  • Selecting Map From Request Body will allow you to update the field with a value from the Response Body.
  • If you choose URL Parameter, you will be able to enter the incoming URL parameter to use to map into the field.
  • Formula: This allows you to build a formula using the current object’s fields that will be used to generate the node. See more details in the “Using Formulas” section of this user guide.
  • Custom Metadata: This allows you to map a field from a Custom Metadata Type record.
  • Custom Setting: This allows you to map a field from a Hierarchy or List Custom Setting record.

 

Create Record

Here you have the option to create a new record, related or unrelated to the main record identified above.. You can select the object type you want to create and choose how it’s related to the main object.  To create a new record, select the Add New ‘Create Record’ Action.

Choose your Object Type. Because we have identified the main record in the previous step, you can select how to relate this new record to the main record.

Further, if you select ‘Add Field,’ you can map additional fields in your record creation. You can choose to set static values to a field, map from a request body node or from an incoming URL parameter.

 

Update Related Record

Similar to our previous examples, this option allows you to update a record related to your main object. For example, if you wanted to update the parent account record related to the main Account record.

 

Upsert Single Record

This option enables you to update a record that can be identified by matching a Salesforce field with a node value. If no record is found, then you have the option to create it.

If you select a value in the “Related to the main record” input, only the records related to the main record are identified, and if a record needs to be created, it will be linked to the main record.

Just like the other actions, you can map fields from the JSON response or static values. Additionally, you can use the “Set Only On New Records” checkbox to limit some of the mapping to the create action only.

 

Upsert List of Records

This option enables you to update a list of records based on a list from the JSON response. Each record can be identified by matching a Salesforce field with a node value. If no record is found for each list item, then you have the option to create it.

If you select a value in the “Related to the main record” input, only the records related to the main record are identified, and if a record needs to be created, it will be linked to the main record.

You need to select a JSON list from the response by clicking on “Select” next to “Mapped From JSON List”. After selecting a JSON list, choose how to identify each record by selecting a Salesforce field and a JSON node from inside the JSON list.

Just like the other actions, you can map fields from the JSON response, URL parameters or set from static values. Additionally, you can use the “Set Only On New Records” checkbox to limit some of the mapping to the create action only.

 

Create / Update File

This option enables you to create or update an Attachment or a File (ContentDocument) based on the request.

First, you need to select what type of record you want to create: File (ContentDocument) or Attachment. After selecting, you will be able to choose the field and node used to identify an existing record to update, in case you want to update an existing file or attachment.

Then you can map fields from the JSON response or static values. Additionally, you can use the “Set Only On New Records” checkbox to limit some of the mapping to the create action only.

 

Run Autolaunched Flow

This feature allows you to utilize the capabilities of an “Autolaunched Flow (No Trigger)” to perform complex calculations and logic beyond basic record insertions and updates.

The process begins by selecting a flow. If the flow requires input variables, a list will be displayed for mapping. These inputs can be either the main record ID, a URL parameter or individual values from the response body. When the inbound call takes place, the flow will be executed using the mapped input values.

Only active Autolaunched flows without trigger can be selected.

Run Apex

This option allows you to run an apex class when the inbound call is received.

 

The class you enter needs to be a global class that extends the d_wh.InboundActionCallable2 abstract class and implements the d_wh.InboundActionCallable2.CallResponse Run(Map<String, String> parameters, Map<String, String> headers, String requestBody) method.

Below is an example class that can be used as a “Run Apex” inbound action.

global class TestCallable extends d_wh.InboundActionCallable2 {

    global override d_wh.InboundActionCallable2.CallResponse Run(Map<String, String> parameters, Map<String, String> headers, String requestBody) {

        // Add code to handle inbound call
        return null;
    }

}

The parameters parameter contains the URL parameters received by the inbound call.

The headers parameter contains the headers received by the inbound call.

The requestBody parameter contains the received body as string.

The d_wh.InboundActionCallable2.CallResponse return object is reserved for future use. Return null for now.

 

Call Action Criteria

For each call action, you have the option to select if the action will run. By default, the actions will always run. You can customize that by scrolling down to the “This Action Runs” section and click on “[Customize]”

 

Here, you can specify custom criteria based on header values, URL parameters, as well as the request body items.

 

Additionally, the action can be skipped if the main action “Find/Update a Main Record” failed to identify or create a record. You can set that using the checkbox below:

 

Additional considerations

If you are mapping values into Date or DateTime fields, the received value needs to be in the standard yyyy-MM-dd format for Date fields or yyyy-MM-ddTHH:mm:ss.sssZ format for DateTime fields.