Update record action can update fields in a record, as well as in other records referenced by any of its lookup fields.
You may select one or multiple fields to be updated at once.
Target value is a Twig template, so you may use static content, data placeholders and any other Twig code.
If you have other Workflows that depend on fields you're changing in this action so they need to be triggered after this action is executed, check the Re-evaluate workflow after field(s) change box.
Updating fields in a related record
One of the most powerful feature of Mapsly's Update record action is its ability to update fields in a related record referenced by the current record's lookup field.
To update such a field:
1- First select the lookup in the list of fields (lookup fields always come first and have the > sign at the end):
2- Then in the popup that will appear select the field from the related record that you'd like to update:
3- The selected field will appear after the lookup fields:
In this example, we're updating the Account Type field in the Account record referenced by the Contact's Account Name lookup field.
Determining which field to update at runtime
Mapsly also allows you to indicate at runtime the API name of field(s) to be updated, which is useful for example when using an Update record action in a cycle with unknown number of records at design time. To do this, select Custom in the Field selector and fill in the additional input field that will appear with the Twig template that will resolve into an API name at runtime:
(In this particular example, this Update record action can used in a Match-action block of a Match records action - to fill in lookups to the found clinics on a Patient record in a CRM that doesn't support Multi-Select Lookup fields.)
Updating a simple lookup field
A simple lookup field references one record of a fixed related object. For example, in a CRM, a Contact record may have an Account lookup field that references its Account record.
A simple lookup field in a record stores the ID of a record in the related object. So to update it, simply specify the target record ID in the Target value input.
Updating a polymorphic lookup field
A polymorphic lookup field references one record of one of several objects. For example, in Zoho CRM, the Related To field in a Meeting object of one record may reference a Deal record, while the same this field another record may reference an Account record.
A polymorphic lookup field in a record stores both the related object's API name and the ID of record ID in that object. So to update a polymorphic lookup field, set the Target value to the following json structure:
โ{"recordId": "yourRecordId", "object": "objectApiName"}
,
where
yourRecordId
is the ID of the target record,and
objectApiName
is the API name of the object to whichyourRecordId
belongs.
In actions' parameters (which are Twig templates) you may use Twig expressions to set both recordId
and object
at runtime from your action's execution context, for example:
{"recordId": "{{ record.id }}", "object": "{{ record.__objectApiName }}"}
sets the selected polymorphic lookup's value to the record for which the action is being executed (no matter its object). Here we used __objectApiName
system field to retrieve the API name of the object at runtime.
Here's how it will look in the action's field list: