Create record action allows you to create a record of any object, including related records like check-in records, logged calls or meetings.
Target value here is a Twig template, so you may use static content, record data variables placeholders and any other Twig code.
If you have other Workflows that depend on records you're creating in this action so they need to be triggered after this action is executed, check the Re-evaluate workflow after field(s) change box.
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 a Create 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 Create record action can used in a Match-action block of a Match records action - to create a new record of a desired object for each of the found clinics.)
Setting the value of 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.
Setting the value of 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:
Creating child records in the same execution session
If you need to create a record referencing another record that has been created earlier in the same execution session, use the Commit action to force Mapsly to save changes in data that have been accumulated up to the current moment in the current execution session and to populate the id
of the newly created records in their respective Create record actions' execution context, so you can then retrieve this ID in subsequent actions using a reference to the Creat