Get Account Attribute for Workflows

Creating a workflow that creates an off-boarding ticket to SNOW for the account. However, SNOW needs the SNOW sys-ID to input into the ticket rather than the ISC displayName… I can call the account for that user but I can ot figure out the correct Syntax logic to add to the jSon body,

{“sysparm_quantity”:“1”,“variables”:{“select_contingent_worker”:“{{$.getAccounts.accounts.sys_id}}”,“sysparm_requested_for”:“XXXXXXXXXXX”}}

it is in the output but how do i add it to the SNOW body as above, The one i am using isnt working

As $.getAccounts.accounts will be an array., you need to specify the index of the account from where sys_id needs to be read.

You can use something like this:
$.getAccounts.accounts[?(@.sourceId == "ID_OF_SNOW_SOURCE")].sys_id
or probably
$.getAccounts.accounts[?(@.sourceId == "ID_OF_SNOW_SOURCE")].attributes.sys_id

It will be the later one $.getAccounts.accounts[?(@.sourceId == “ID_OF_SNOW_SOURCE”)].attributes.sys_id

1 Like