Use GetDataSourceUserID()
to get the data source user ID of the user who triggered the current automation execution session, for example clicked a button or created/updated a record that triggered a workflow, to assign the ownership of a record to the user.
In a session triggered by a system event, like regular import from a data source, a webhook from a data source, a Mapsly API call, auto-assignment of a record to a territory, or a schedule, the function returns null
.
Which data source user ID is retrieved
The function retrieves the user ID indicated in the user's personal preferences for the data source to which the input record(s) of the current automation session belong. For example, if an automation session was triggered for an Account record in the YourCRM data source, the function will retrieve this user ID:
If an automation session has no input record(s), the function returns null
.
How to use GetDataSourceUserID()
for assignment of ownership
Use the function's output in Twig delimiters as the target value for the owner lookup field in Create record or Update record actions:
How to retrieve user IDs for all data source sources
The user's CRM user IDs for all data source can be found in the execution context's currentMapslyUser.userIds
array.