How do I comment on triggerIssue and Destination issue of a link?

Alicia Pena May 24, 2023

I need to add a comment to both the triggerissue and the destination issue, if a link was added to a jira in maintenance mode.

I was able to add a global automation rule:

"When Issue Linked

For Destination issue

   if status equals Maintenance

   then Add comment to issue"

Works great!

But if I also add Another For under When Issue Linked:

"For Linked issues

      if:  Status is one of maintenance

     Then:  Add comment to issue"

That only adds another comment to the same issue, even though it's under the "when Issue linked" section.  

How do you add a comment on the triggerissue?

2 answers

1 accepted

1 vote
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.
May 24, 2023

Hello @Alicia Pena 

When you are using the Issue Linked trigger the rule recognizes two issues; the "source" issue and the "destination" issue. The "source" issue is the one that triggers the rule. Determining which issue is the "source" and triggers the automation vs. the issue that is the "destination" depends on which issue gets the Inward Description vs. the Outward Description for the link.

If you are putting the same comment on both issues then the structure of your rule would be:

TRIGGER: When issue linked
BRANCH: For Destination issue
CONDITION: If Status = Maintenance <<<this applies the condition to the other/destination issue in the linked pair
THEN ACTION: Comment on Issue <<<this adds a comment to the other/destination issue in the linked pair
CONDITION: If Status = Maintenance <<<this applies the condition to the trigger/source issue
THEN ACTION: Comment on Issue <<<this adds a comment to the trigger/source issue

I tested this in Jira Cloud, but I would expect it to work in Jira Server/DC also.

Screen Shot 2023-05-24 at 4.19.37 PM.png 

Alicia Pena May 25, 2023

Thank you.  I'm not on cloud and the comments will be different.  Trying to figure out how to have two separate comments, one for source and one for destination.

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.
May 25, 2023

You can still have two different comments.

You just need to make sure you understand which issue will be considered the "source" (trigger) issue vs. the "destination" issue.

Are you going to do this for just one link type, or will it be for multiple link types?

For the Link Type(s) where you want to use this what are the Inward and Outward Descriptions for the link type? That information will be on the configuration page for the Issue Links. A Jira Administrator will have access to that information.

For example in my system the Blocks link type has this information.

Screen Shot 2023-05-25 at 2.29.33 PM.png

Let us say that we link AAA-1 to BBB-1 with this link type thus:

AAA-1 blocks BBB-1

Conversely

BBB-1 is blocked by AAA-1

AAA-1 will be the "source" issue that triggers the rule. BBB-1 will be the destination issue.

So, for whatever link type you have, when the relationship of the linked issues is

AAA-1 <outward description> BBB-1

...then AAA-1 is the source/trigger issue.

 

If the Inward and Outward Descriptions are the same, as with the Relates link type, then the issue you are in when you create the link is always considered the "source"/trigger issue.

 

As long as you can keep that straight and know to which issue (source/trigger vs. destination issue) you want to apply the comment then you can automate the application of the comments.

Alicia Pena May 25, 2023

I tried adding another condition If: status equals maintenance under the For Destination issue, as you suggested.  However, nothing gets commented on the trigger (source) jira.  The first Add comment gets posted on the destination jira.  But the second Add comment doesn't post on either.

Screen Shot 2023-05-25 at 2.38.52 PM.png

Alicia Pena May 25, 2023

After looking in the logs it is checking if the Source ticket is in Maint mode.  The source or trigger ticket will never be in maintenance status.  Only the destination ticket will be moved into maint mode.  So I need to figure out how to check that the destination ticket is in maint mode, same as the first If: status equals did.

Alicia Pena May 25, 2023

Only the destination jira will be put into maintenance mode.  If any other ticket links to it with any link type, after the destination ticket was put into maintenance status

1.  The maintenance ticket gets a comment "THE ISSUE {{triggerIssue}} HAS BEEN ADDED AFTER THE MAINTENANCE FREEEZE!"  this works great

2.  The source/trigger ticket (Which will NOT be in maintenance mode) should also get a different comment on that ticket.

My problem I'm having is trying to add the second part by checking if the destination ticket status is in Maintenance status then add the comment to the source/trigger ticket.

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.
May 25, 2023

Thank you for that additional explanation.

If the comment should be added to the source issue only if the destination issues Status=Maintenance then change this condition:

Screen Shot 2023-05-25 at 3.48.33 PM.png

Change that to an Advanced Compare.

Screen Shot 2023-05-25 at 3.55.13 PM.png

Alicia Pena May 30, 2023

It's still not working.  I used DEVTOOLS-22789 (Which is not in Maint mode) to link to ticket INF-262719 (which is in Maint Mode).  The destination ticket was commented on, the email was sent, the source ticket still did not get a comment.

This is the audit log:

Issue linked

Destination issue (to perform actions on this issue use a 'Related branch', you can also access it via {{destinationIssue}}):
INF-262719
Source issue (the main branch of the rule will execute for this issue and you can access it via {{issue}}):
DEVTOOLS-22789

Issue condition

The following issues passed:
INF-262719

Comment on issue

Comment added to issue
THE ISSUE {{triggerIssue}} HAS BEEN ADDED AFTER THE MAINTENANCE FREEEZE!

Send email

Successfully sent email.
INF-262719

Advanced compare condition

The following issues did not match the condition:
DEVTOOLS-22789

This is the rule:
Screen Shot 2023-05-30 at 2.51.56 PM.png
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.
May 30, 2023

Add a Log action just before the Advanced Compare to print out {{destinationIssue.status.name}} to the rule's Audit Log.

What is the exact name of the "maintenance" Status value assigned to the DEVTOOLS issue? The comparison might be case sensitive. I notice your latest copy of the rule shows that comparison using Maintenance where you previous images show the Status field being compared to maintenance.

0 votes
Alicia Pena May 31, 2023

aha!  You got it.  I don't type it in when selecting the maintenance value for the issue field condition, it's a pull down menu option.  But I did type it in for the compare two values and capitalized the word Maintenance.  So it would never match.  Thank you so much for all of your help. It works perfectly now.  You have been very helpful and I appreciate it!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.20.12
TAGS
AUG Leaders

Atlassian Community Events