Hello,
I'm builiding an automated approval process based on user properties that i have fed into the JWME user properties via API. Currently having problem with finding the right syntax to extract accountId from email. Row in the editor looks like this:
manager | {"email":"xyz@zzz.com"} |
Current script looks like this:
{{ issue.fields.reporter | userProperty ( "manager" ) | dump | replace('{"email":"', "") | replace('"}', "") }}
I am replacing and trimming my string to have only email value at the end, but i am struggling to find a method how to convert that email into the user object and its accountId. Is there anyone that could potentially help me with this?
This is how you can extract the email:
{%set email = issue.fields.reporter | userProperty ( "manager" ) | field("email") %}
And to get the user that has that email:
{%set user = email | findUsers | first %}
Finally, to return the accountId (for use in a Set Field Value post function for example):
{{ user.accountId }}
The whole thing in one go:
{{ issue.fields.reporter | userProperty ( "manager" ) | field("email") | findUsers | first | field("accountId") }}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.