Forums

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

linked Issue

Anderson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 29, 2022

Hi guys, I need your help. I am working on a post-function with JMWE, when I add a new link type and
this is = "It is from the Program", I need to see if there is another issuelink
before this one and delete it,
to leave the new relationship that the user is creating. I am using this code to iterate through the array:
{% if linkedIssuesMap.length != 0%} {% for linkedIssue in issue.fields.issuelinks %} {{linkedIssue.inwardIssue.key }} {% endfor %} {% endif %}
which brings me the issues that are linked:
Your template ran successfully Result value: PPG-1 PPG-2 But I only want to bring the first one (PPG-1) What am I missing to do? Thanks in advance for your help!

2 answers

0 votes
David Fischer
Community Champion
January 30, 2022

Hi @Anderson ,

where are you placing this JMWE post-function? On a transition, or on an Event-based action listening to the issue_link_created event?

If on the latter, then this is the configuration you want:

image.png

The Nunjucks condition for the Event-based action is:

{{ context.issueLink.issueLinkType.outwardName == "blocks" }}

The Nunjucks condition for the Unlink Issues post-function inside the action is:

{{ linkTypeName == "blocks" and context.issueLink.destinationIssueId != linkedIssue.id }} 

Of course, you'll need to adjust both for your issue link type direction. Replace "blocks" with "It is from the Program" and, if "It is from the Program" is not the "outward" link type direction name (on the Issue Linking admin page), then replace inwardName with outwardName in the first script.

Saúl Alexander Mata Velásquez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 31, 2022

Hi David, and Tx by your answer. 

Try to do it from the event, carry out all the steps, execute the corresponding action, but even though the event executes satisfactorily, it does not carry out the action that I expect in the issue that is linked!
I'm trying to do it with a global automation, but it goes into a loop, since I'm trying to leave the last issue that was linked!

David Fischer
Community Champion
January 31, 2022

Hi @Saúl Alexander Mata Velásquez ,

what is happening, or not happening, when the event-based action runs? Also, did you wait a few seconds and then refresh the issue before checking?

Can you share the configuration of the event-based action you have configured?

0 votes
Pramodh M
Community Champion
January 29, 2022

Hi @Anderson 

Welcome to the Community!!

We could use Automation for Jira

Trigger - Issue Linked

Condition - Check if the Issue linking is present

Action - If present delete the ones which were used before by using smart values

If we need to check the issue linking when a user links an issue, it's only possible in case we are editing the field when making a transition, field behaviors aren't a thing in the cloud yet!! I guess.

Thanks,
Pramodh

Saúl Alexander Mata Velásquez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 31, 2022

Hi Pramodh M

Tx by your answer

This idea is good, but it doesn't work for me, try to do an automation to solve it!

On the contrary, I used a global automation involving all its specifications and also the two projects and their link types, and I added at the end the issue that I needed to link to!
This works but it generates a loop that I have to keep solving

Tx regard!

Suggest an answer

Log in or Sign up to answer