Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

What am I doing wrong with my automation?

JayJuan Jones
Contributor
March 14, 2022

Hello guys,

I am working on a new automation to link all issues together based on my customfield "User's Email Address" I used on of the automations scripts in the Atlassian Library and tried to tweak it for my needs, but I can't tell what I am missing/doing wrong. Any help would be much appreciated!!!

 

link realted issues .png

1 answer

1 accepted

1 vote
Answer accepted
Mark Segall
Community Champion
March 14, 2022

Hi @JayJuan Jones - The way I'm interpreting your use case, it sounds like the custom field is a simple short text field.  In this case, you would need to change your lookups to use this:

{{issue.reporter.emailAddress}} = {{customfield_10041}}

Because of this, you would want to change your condition to an advanced condition.

JayJuan Jones
Contributor
March 15, 2022

I made the update and still no luck:

after update.png

Mark Segall
Community Champion
March 15, 2022

Hi @JayJuan Jones - Your Branch is not going to work because it's trying to perform a JQL search where Reporter = an email address where it needs to be an ID value.  Instead, try flipping your JQL around like this:

[cf]10041 = {{Reporter.emailAddress}}
JayJuan Jones
Contributor
March 15, 2022

still no luck :(

could it be because the logic above is referencing a field called emailAddress and my field name is called User's Email Address which is customfield_10041?

after update 1.png

Mark Segall
Community Champion
March 15, 2022

Uggh - Typos on my part.  Try this:

In your condition, change {{customfield_10041}} to

{{issue.customfield_10041}}

In the JQL, change to this:

[cf]10041 = {{issue.Reporter.emailAddress}}

Hopefully those two changes fix the issue.

JayJuan Jones
Contributor
March 15, 2022

Still not meeting the condition; I'm wondering if .emailAddress needs to be changed. I have these two issues I am trying to automatically link with this automaiton:

Screenshot 2022-03-15 122700.png

here is the details for one of them; I don't have an email address field completed, but I do have User's Email Address:

Screenshot 2022-03-15 122451.png

Lastly; when I manually run the automation, still no effect, it's not meeting the condition, looking at the automation, everything looks good except .emailAddress

Screenshot 2022-03-15 122646.png

Mark Segall
Community Champion
March 15, 2022

The problem is that when you're performing action against Reporter, it's going to be a Jira ID that is returned, while your custom field is looking for email.  Reporters are users and users have email as an attribute which is why {{Reporter.emailAddress}} needs to play a factor in the logic.

As a troubleshooting step, let's add a Log Action activity with the following:

Reporter Email: {{issue.reporter.emailAddress}} | CF10041: {{issue.customfield_10041}}

Then execute again and look at the log to see what values are captured.

JayJuan Jones
Contributor
March 15, 2022

ah, so that would explain why the Reporter seems to be always encrypted when I click their emails from the customer page. Here is what I see:

Screenshot 2022-03-15 145523.png

 

this would explain why the condition is failing. Should I rethink this approach? My main goal is to link issues based on the customfield User's Email Address; I don't think the reporter matters as much. 

Mark Segall
Community Champion
March 15, 2022

Yeah, you can change it up where your branch JQL is this:

cf[10041] = {{issue.customfield_10041}} AND KEY != {{issue}}

This will perform a search for all issues that have the same value in your custom field and ignores the trigger issue (needed so you don't get errors when it tries to establish links to itself).

JayJuan Jones
Contributor
March 15, 2022

like this 

Screenshot 2022-03-15 155701.png

or should I remove the advanced compare condition all together?

Mark Segall
Community Champion
March 15, 2022

Yeah should be no need for the advanced compare now.

JayJuan Jones
Contributor
March 15, 2022

Awesome, didn't think we did. Now I'm getting another error:

 

Screenshot 2022-03-15 161700.png


is the syntax wrong for cf?

Mark Segall
Community Champion
March 15, 2022

My bad... Yes. Just updated my previous post.  Should be [cf]10041.

JayJuan Jones
Contributor
March 16, 2022

weird! I updated it and I still got the same error, it looks like it was expecting cf and that's what we put. What am I missing here?

Screenshot 2022-03-16 092946.png

Mark Segall
Community Champion
March 16, 2022

Alright... I'm going to go stand in a corner and flog myself!  🤦‍♂️  Once again.... Bad syntax on my part.  It should be cf[10041].  I will never forget your custom field ID. 

JayJuan Jones
Contributor
March 16, 2022

LOL no worries, you have been great help!!! We got past that error, but I have another error I am getting now:

Screenshot 2022-03-16 110517.png

JayJuan Jones
Contributor
March 16, 2022

omg... I can't share my thoughts on the error because of HTML errors

Mark Segall
Community Champion
March 16, 2022

Interesting - Does it work if you put quotes around the smart value?

cf[10041] = "{{issue.customfield_10041}}" AND KEY != {{issue}}
JayJuan Jones
Contributor
March 16, 2022

got past the @ now it's saying this:

Screenshot 2022-03-16 144656.png

 should I spell out equals instead of using the sign?

Mark Segall
Community Champion
March 16, 2022

Your custom field is a short text field so the "=" operator won't work.  This needs to be a fuzzy search. Try this:

cf[10041] ~ "{{issue.customfield_10041}}" AND KEY != {{issue}}
JayJuan Jones
Contributor
March 17, 2022

that seemed to have taken care of it!!! thank you so much for all your amazing help! I hope this forum will be of great value to someone else in the future!! 

Like Mark Segall likes this

Suggest an answer

Log in or Sign up to answer