Forums

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

parent issue in specific project

Steven Vits
Contributor
January 27, 2024

I want to create a rule where comments on linked issues are copied in all related issues only when the parent issue is in a specific project.

I got stuck for the moment and do not use scriptrunner.

trigger: all comments

if linked issues are present

then I think i have to determine the location of the parent but it constantly failes.

Some help is wanted to get the first basicsteps in Jira Automation.

 

1 answer

1 accepted

0 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 27, 2024

Hello @Steven Vits 

You can access the project key of an issue's parent issue with this smart value:

{{issue.parent.project.key}}

You can use an Advanced Compare condition to compare that to the key of the project that matters.

Steven Vits
Contributor
January 28, 2024

Thank you very much for your reply @Trudy Claspill

I tried your smart value but got a blank value in return.

these are my steps for the moment to try it out:

1. when issue commented (all comments).

2. If linked issues are present all link types

3 create variable (a nobel try to work with vars). Varname ParentIssueKey, smart value {{issue.parent.project.key}}

4. Web request to be able to visualize what is happening:

{
"IssueKey": "{{issue.key}}",
"parentIssue": "{{issue.parent}}",
"parentIssue2": {{issue.parent.project.key}},
"parentIssue3": "{{issue.parent.project.key}}",
"Projectkeuze": "{{userInputs.ProjectKeuze}}"
}

the return: 

{
  "IssueKey": "Key-12",
  "parentIssue": "",
  "parentIssue2": null,
  "parentIssue3": "",
  "Projectkeuze": ""
}
5. lookup issues jql :parent = {{issue.parent.project.key}}

LOOKUP ISSUES
There was an error executing a search during custom value definition: .
Custom Smart Value JQL Search: "parent =" - Error in JQL Query: Expecting either a value, list or function before the end of the query.
Probably being new in jira automation I'm missing something here.
There are in this test 2 issues involved, Key-12 and KK-297. The first is cloned (child) by the second (parent).
is there a way of figuring out what I am missing?
thanks in advance
regards

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 28, 2024

Hello @Steven Vits 

There has been a misunderstanding.

When you said "parent" I assumed you were using the term as Jira does, to indicate a Jira-recognized parent/child relationship such as between a task and a subtask or between an Epic and it's child issues.

In your latest reply you have indicated that you are referring to cloned issues. That uses generic issue linking and is not recognized by Jira as a parent/child relationship. The "parent" field is reserved for the recognized parent/child relationships.

When you clone an issue, do you see an entry added to the Issue Links section for both the original and new issue? Can you provide a screen image of the issue where you would be entering the comment that triggers the rule? In that image I'd like to see the Issues Links section. Please then indicate which issue in that section you consider the "parent".

Are you trying to copy the comment to issues linked to the child, or to issues linked to the parent?

Also, please show screen images that show your complete Automation rule.

Steven Vits
Contributor
January 29, 2024

Thank You for the clear understanding, it seems indeed I was missing some correct defining of the terminology. 

Clone.pngClone2.png

Wat I am trying to do is copy comments when the master clone is in 1 specific project.

The left Issue is the 'master' and the right one is the 'slave'.

When master or slave I do want the comments be copied in each other only when master is in project TP.

I do see now my previous actions do not stand further because they are complete wrong due a lack of knowledge on my behalf.

What I intentionally (succesfully but unwanted) created was a rule that copied all comments of all related issues on the tenant.

rule.png

After that I got stuck finding the parent Issue. that is never going to work due lack of a parent issue.

In this Case I shall have to look after the 'Is cloned by' by and 'clones' in at least one 'related issue condition'.

I will search further on that. maybe it will be necessary to provide 2 rules, 1 for cloned by relation and one for clones relation.

Thank you for clearing out my misunderstanding, feel free to provide me some tips and tricks on this solution.

regards

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2024

Hello @Steven Vits 

When you clone issues from the TP project, do you sometimes move them to other projects?

If the source issue and the new issue might be in different projects, then you will need a rule scoped for multiple projects.

If the new issue (the one created by cloning) might be in a different project, are there a limited number of projects it might be in, or might it end up in any project in your instance?

I ask because you will need to either define the rule scope as "Multiple Projects" and select the TP project plus all the projects where the new issue might end up, or you have to set the rule to have a Global scope so it can be initially triggered by a comment on any issue in any project.

Do you want this process done for only specific issue types? If so, I would recommend adding that as a condition in the rule after the trigger.

Can a source issue be cloned more than once? Example:

Source issue: TP-1
- XY-1 is a clone of TP-1
- AB-1 is a clone of TP-1
- TP-2 is a clone of TP-1

In the above scenario, adding a comment to TP-2 would, per your requirement, copy the comment to TP-1. Would you then want that copied comment that has been added to TP-1 to be copied to XY-1 and XY-2?

And if a new comment was added directly to TP-1, would you want the comment added to all of its clones? That is a slightly different scenario than if a comment was copied to TP-1 through Automation.

I would indeed recommend that you create two rules; (1) one for copying comments from the source issue to the clones, and (2) another for copying comments from the clones to the source issue.

 

Rule 1: copy from source issue to clones

TRIGGER: comment added
CONDITION:
if the rule should be limited to issues of a specific type,
add a condition to check the issue type
CONDITION: Issue Fields
Field: Project
condition: equals
value: TP
FOR EACH: Related Issue
Type of Related Issues: Linked Issues
Link Types: is cloned by

ACTION: Comment on Issue
Here you can reference pieces of the comment that triggered this
rule using {{comment}} such as {{comment.body}}

 

Rule 2: copy from clones to source issue

TRIGGER: comment added
CONDITION:
if the rule should be limited to issues of a specific type,
add a condition to check the issue type
CONDITION: Issue Fields
Field: Project
condition: is one of
value: (select all the projects where clones may exist for TP issues)
FOR EACH: Related Issue
Type of Related Issues: Linked Issues
Link Types: clones

CONDITION: Issue Fields (checking if the source issue is in TP)
Field: Project
condition: equals
value: TP

ACTION: Comment on Issue
Here you can reference pieces of the comment that triggered this
rule using {{comment}} such as {{comment.body}}

 

Like Steven Vits likes this

Suggest an answer

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

Atlassian Community Events