Setting Regarding Field on Tasks Programmatically

When creating or updating a Task using an Online Flow, the Regarding record can be set by filling in one of the many provided fields, depending on the entity type. But this can be an issue if the Type of regarding entity is not known beforehand.

To get around this issue, it is possible to set the regarding record directly using JSON, bypassing the standard UI. The following will use an example of creating a follow up task for an Appointment record.

The flow will start with a typical process of triggering the flow on creation or update of an Appointment record, followed by another step to create a Task.



Next, to view the data that is sent by the Flow, the Regarding field will be set to a test record, here it’s an Account record.



After testing this flow, we can open the flow run, and search the results Bodys for .the “associated navigation property” for the regarding object ID.





For our case, the string is "regardingobjectid_account_task”.

Next, a String variable is initialised with the table name of the entity to update, in our case ‘tasks’.



Now, a new Update step is created, with the string variable used for the Table Name.



Note that By using a dynamics value for the table name, a ‘Row Item” field is shown, which allow for the direct input of a JSON payload.

Using the string found above, and the GUID of the test account, the Row Item field can be entered a follows.



Now, the following fields on the Appointment record can be used to replace some of the static :

· Regarding (Table Name) – The Plural name for the record type (e.g. accounts)

· Regarding (Type) – the singular record type (e.g. account)

· Regarding (Value) – the GUID of the regarding record



Now when the flow is triggered, it will create a Task that is regarding the same record, no matter what type of record the Appointment was regarding.

Also, as an extra note, to copy the Owner value for the Appointment record, the “Owner(Table Name)” dynamics value can be used.



This allow for the Owner of the Appointment being either a System User, or a Team.

0 views0 comments