Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JMWE Automated Approval based on User Entity Property

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?

 

1 answer

0 votes

Hi @Matus Klaudiny _EXT_ 

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") }}

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Trello

🏊‍♀️ Atlympic Event: Trello

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

84 views 0 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you