Forums

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

How to Make an automation to compare

CRS123456 July 31, 2022

Hello,

I don't know if am I choosing the right way or not but I have to ask about it experts.

I have an issue type (user leaving) in the Jira server.

In the user leaving issue, we have a Full Name field. at the specific status, I want to compare the Full Name value with the assignee's name in all of the issues in all projects. If the assignee's name is equal to the Full Name field eventually list the issues and email them.

I'm not very good with JQL and search for anything that I want on the net.

Is this even possible with automation? or do I have to think about script runner?

Thank you

 

2 answers

1 accepted

1 vote
Answer accepted
Nir Haimov
Community Champion
August 1, 2022

Hi @CRS123456 

does "Full Name" field is a free text field or user picker field?

Nir Haimov
Community Champion
August 1, 2022

I'm pretty sure it can be done in automation, just let me know about the field and I will try to tell you how to implement it.

Like CRS123456 likes this
CRS123456 August 1, 2022

Hi @Nir Haimov 

The Full Name is a free text field.

I do this but it just returns one issue while I searched it has to return 5 issues in the email. userleave.jpg

Nir Haimov
Community Champion
August 1, 2022

@CRS123456 your automation seems to be ok.

Did you check just your JQL, does it return all the issues you want?

Does your issue is in the JQL step or the email step?

Can you share a screenshot of the email step too?

CRS123456 August 1, 2022

@Nir HaimovI don't know how to check my JQL.

Maybe it's from my email.

user2.jpg

Nir Haimov
Community Champion
August 1, 2022

i think the email is fine, also, you say you get 1 issue in the email, i think if the problem was the email you would have get nothing...

try to add "log" step and log your JQL result, than see what the logs print

Like CRS123456 likes this
CRS123456 August 1, 2022

Thank you @Nir Haimov 

I'm new and I don't know how to use "log"? where can I add it?

Nir Haimov
Community Champion
August 1, 2022

Hi @CRS123456 

It's ok, you can add "Log" action anywhere you want in the automation process.

Simply click to add new action and choose "Log Action" (not "Log work") :) 

log.jpg

Like CRS123456 likes this
CRS123456 August 1, 2022

@Nir HaimovI found it and put it in after the IF.

It wants some value. is it right? I put {{now}}.

I saw some problems like mine!! where can I see the results?

@Nir HaimovDo you think if condition points to all projects and all issues?

Nir Haimov
Community Champion
August 1, 2022

Hi @CRS123456 

i looked further into this.
This can't be exactly perform as you whish in Jira Server (in cloud they have this feature).

What you can do int Server is the following

2.jpg

But this will send you 1 email for each issues found in the JQL (and not 1 emails with all issues in it)

So i think that eventually it will better to do this with ScriptRunner

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 1, 2022

Hi @CRS123456 and @Nir Haimov 

For the server/data center version of automation rules, you can use the bulk-processing option with that branch, and so send only one email: https://confluence.atlassian.com/automation/run-a-rule-against-issues-in-bulk-993924653.html

Kind regards,
Bill

Nir Haimov
Community Champion
August 1, 2022

Hi @Bill Sheboy 

That's right, but @CRS123456  doesn't want it to be run on schedule, he wants it to run on transition change, and there is no option to do it on transition change.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 1, 2022

Correct; my understanding is the branches also support this bulk processing feature...not just scheduled triggers.

CRS123456 August 1, 2022

@Nir HaimovI think scheduled is not bad such as every day at 10 am if the status is Leader Review.

but when I put unresolved condition in the scheduled it returns 4900 issues and throttled so this is not right.

@Nir Haimovwhen I looked at the audit log I saw config change was in the global but when the rule was run, the project was ESD while I want this rule runs in all projects.

Some work is not right and I don't know where!!!

user4.jpg

CRS123456 August 1, 2022

@Bill SheboyThank you to join us

I don't know how to use bulk processing. Do you have any idea about my problem?

Nir Haimov
Community Champion
August 1, 2022

Hi @CRS123456 check in your "rule details" (top left) make sure this rule configured for all projects and not specific project

Like CRS123456 likes this
CRS123456 August 2, 2022

@Nir Haimov Yes It's on all projects.

I'm trying a different way but it still shows me one issue in the email.

I can't understand!!

user5.jpg

Nir Haimov
Community Champion
August 2, 2022

Hi @CRS123456 

That's because your automation is wrong.

You should use it with "schedule" as @Bill Sheboy suggested.

Like CRS123456 likes this
CRS123456 August 2, 2022

@Nir HaimovThank you very much

For when I use scheduled and gave it a time and for condition, I wrote resolution and assignee to my name as a result the email was sent right.

Now I have to change the assignee to the Full Name field value. The hard part is here!!

@Bill Sheboy 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 2, 2022

Hi @CRS123456 

What do you mean by "Now I have to change the assignee to the Full Name field value"?

I believe that @Nir Haimov already asked if this was a user-picker field or text field.  If it is a user-picker, it should be simple to just assign the person.  If it is a text field, containing the name, you will need a way to determine the user's accountId from the name, such as by calling the REST API.

CRS123456 August 2, 2022

@Bill SheboyThank you for helping me.

The Full Name field is a text field and every time value is different so I want to compare the Full Name value and assignee of all issues and returns the issues in the email.

If necessary I can change the Full Name to a user picker if it works easier because I don't know about REST API.

one more thing, I read somewhere I can use smart value in the JQL but in mine, it didn't work. does it have a special rule? Or maybe I used it in the wrong place!!

note: I changed Full Name field to a user picker because It doesn't anybody write wrong. Also, it doesn't matter for me if had a schedule or not and when I start automation with issue transitioned all commands run in in one project whereas I want the result in all issues.

0 votes
CRS123456 August 3, 2022

@Bill Sheboy @Nir Haimov  Thank you, guys.

Finally, I found the answer. I'm a seeker finder. I want to scream.

In this topic, I learned something new. very helpful.

user6.jpg

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 3, 2022

Well done!

Suggest an answer

Log in or Sign up to answer