Checking if a user has specific account assigned using Workflows

Hi,
I am trying to create a workflow that will perform some action if user has the account assigned.
To check if the user has a specific account assigned I have tried multiple options but no luck:

  1. Compare Numbers operator: $.getAccounts.accounts[?(@.sourceId==“<source_ID>”)].length() Greater than equals to 1
  2. Compare Strings operator: $.getAccounts.accounts[?(@.sourceId==“<source_ID>”)] contains "

Both are not working. Could someone please help to identify what may be wrong or suggest any alternatives to check if user has a particular account assigned?

Thanks,
Shreyas

Hi @shreyas_nitturkar

I see that you are using a compare numbers/compare strings so i believe you are going to check for the account first. that if the account exists.

So for this you can use the Operator (Verify Data Type)
This operator has a select field of Exists
And then in the JSON PAth you can simply say something like this:
$.getAccounts.accounts[?(@.sourceId=="3241XXXXXXXXXXXXX'")].id

P.S the image for more information.

Hope this helps :slight_smile:

2 Likes

did you included profile check action in your workflow? look the following doc that will help you

Seems to work perfectly! thanks @neeraj99

@neeraj99 thank you so much for this contribution! I was facing this exact same use case yesterday and couldn’t figure it out.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.