How to assing linked issues from JQL on a Create Issue event on a Jira Rule with smart values

Mauricio Cordeiro June 1, 2022

I'm creating a daily task, which I will like to assing as linked issues the result of a JQL query. 
I don't see the option of linked issues field

1 answer

1 accepted

2 votes
Answer accepted
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.
June 1, 2022

Hi @Mauricio Cordeiro -- Welcome to the Atlassian Community!

First thing: what problem are you trying to solve by doing this?

I ask that question as if your "daily task" could return the same list of issues, day by day, the list of links could get longer and longer.

Next, you could try using advanced branching on the issues, and link them one-by-one in the branch: https://community.atlassian.com/t5/Automation-articles/Branching-over-smart-values-in-Jira-Automation/ba-p/1741935

Kind regards,
Bill

Mauricio Cordeiro June 1, 2022

Hi @Bill Sheboy thanks for the answer.

 What problem are you trying to solve by doing this?
I'm creating a daily stand up task. In this case, the amount of task on the Sprint are limited it will generally decrease or it will be the same amount( In an exceptional case it will increase one or two tasks). The tasks that a developer needs to do are on that Sprint. So, at the end the developer will say what he did yesterday ( task that are on the sprint marks as done and finish the previous business day). The tasks he will do today, task that are in progress or in TODO. It will be easier for the developer read from there and fill the questions. 

So, I can do the JQL for those tasks, but I don't know how to link them to the daily stand up task.

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.
June 2, 2022

Using your JQL and the Lookup Issues action, you would create a list of issue keys, and those would be the input to the advanced branch to then link to the triggerIssue or the created daily task.

{{lookupIssues.key}}

Like # people like this
Mauricio Cordeiro June 3, 2022

Hi @Bill SheboyI tried that but without success, I will probably figure it out way and post the task here. My main problem though is the relation with the field. When I 'm create the Issue, I choose fields to set > Link Issues and there I don't have optino to set a smartVariable

Screenshot from 2022-06-03 12-00-17.png

 

Regarding the advancing branching, I do the filter that has results, and I tried to display just the key on the description ( for testing purposes checking that works) and it doesn't create any task.

Screenshot from 2022-06-03 12-01-34.png

If I understood correctly, it should create new issue for every old issue that is In Progress or ready. ( Again this part is only for testing the iteration of the list of issue), in reality I just want to assign Linked Issues with the result of the query

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.
June 3, 2022

To use smart values in actions like Link Issue, type in the smart value expression (rather than using the drop-down) and it will appear below the field...when it does, select that value and it will be used.

Let's confirm your use case...is this what you wanted?

Once per day...create a new task...which is linked to other issues based upon a JQL query.

If so, you can just branch and not use the lookup.  Please consider a rule more like this:

  • trigger: scheduled daily with no JQL
  • action: create the new task
  • branch: on your JQL to find the issues to link
    • action: link issues using a smart value to get the created issue's key with {{createdIssue.key}}

One more thing to consider...If there is a possibility of no issues found to link, would you create the daily task?  If not now the Lookup Issues (or related issues condition) become helpful to add a test before the task creation.

Like Mauricio Cordeiro likes this
Mauricio Cordeiro June 8, 2022

I think that my automation is not working because I'm doing something wrong, which I can't identify. The JQL return 30 results, so is working. My current automation rule is:

Screenshot from 2022-06-08 10-07-22.png

 

But the LookupIssues is not showing the key or anything. So, that's why I believe the following options doesn't work.

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.
June 8, 2022

Please post an image of the audit log details showing what happens when the rule runs.  That may help clarify what is happening.

Did you try my suggested rule, without the Lookup Issues action and no JQL for the scheduled trigger?

Mauricio Cordeiro June 9, 2022

Hi Bill, the audit log doesn't show much. 

Screenshot from 2022-06-09 08-58-31.png

 

Another weird thing that happens is if I change the trigger to a schedule one it doesn't allow to save the rule.

Screenshot from 2022-06-09 08-59-07.png

 

My Rule is:

Screenshot from 2022-06-09 09-00-14.pngScreenshot from 2022-06-09 08-59-26.pngScreenshot from 2022-06-09 08-59-49.pngScreenshot from 2022-06-09 08-59-59.pngScreenshot from 2022-06-09 09-00-08.png

 

I didn't tried the rule that you suggested because I wasn't sure how to do it.

That is all the info that I have on the rule.
Thanks

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.
June 9, 2022

I just tested the rule I described earlier to confirm it works.  Please try creating a new rule as follows and let me know what you observe.

** For your JQL, a scheduled rule cannot use currentUser() so please update your JQL accordingly **

 

  • trigger: scheduled with no JQL
  • action: create your new task, ensuring that you select your Project and Issue Type
  • branch: on your JQL, and test that the JQL works with Validate Query
    • action: link issues, supplying the key of the created issue as {{createdIssue.key}}

 

You will not need the Lookup Issues action using this method.

Thanks!

Mauricio Cordeiro June 10, 2022

Hi Bill, It doesn't work for me. :( 
The JQL has 36 issues
Screenshot from 2022-06-10 18-56-12.pngScreenshot from 2022-06-10 18-56-36.png

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.
June 10, 2022

Please note that currentUser() is not going to work in a scheduled trigger rule, as the rule actor is probably the Automation User and not a logged in person.

If you need this to work for a specific user, please change the rule actor in the details.  If you need some other behavior, please describe what that is.  Thanks!

Like Mauricio Cordeiro likes this
Mauricio Cordeiro June 15, 2022

Thank you! It did work. It should be specify though that currentUser is null and is used with that context of Weekly trigger.

One think that I'm not being able to accomplish is to get the name of the assignee on a text field ( neither summary or description, tried different fields but not luck, empty all the time)

 

Screenshot from 2022-06-15 10-13-37.png




Possible other question

I would like to iterate over a team or a list of people creating those tasks for each, instead of one. But I believe for beginner like me in Automation Rule on Jira is better to open another question.

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.
June 20, 2022

I am unclear why your displayName is not available.  Two possible causes are that there is no {{issue}} at that point in the rule or that the assignee is Unassigned/null.

Regarding your other question, this seems related so let's try addressing it here...

And, I do not think that is easily possible with your rule.  You cannot have nested branches, so one work-around would be:

  • use an advanced branch on the list of users (either hard-coded or as the results from a REST API call to get members of a group)
  • then use lookup issue with JQL to target each user, one by one, to create the tasks/messages

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events