Remove link using JSON

Sam Hepworth
Contributor
August 30, 2023

I need to remove a link from an issue using automation, and I prefer not to use Jira plug-ins to do that. I have found some documentation that explains how to add a link using Json.

https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/

{"update": { "issuelinks": [ { "add": { "type": { "name": "Relates" }, "outwardIssue": { "key": "{{issue.key}}" } } } ] } }

Can I use similar Json to remove a link - would this work?

{"update": { "issuelinks": [ { "remove": { "type": { "name": "Relates" }, "outwardIssue": { "key": "{{issue.key}}" } } } ] } }

Thanks, sam

2 answers

1 accepted

1 vote
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.
August 30, 2023

Hi @Sam Hepworth -- Welcome to the Atlassian Community!

I did a quick check of the editmeta data and it does not show "remove" as a supported operation for issue links, for the REST API functions available to rules.

So, a noisy work-around (noisy because it causes several issue changes in the history):

  • capture your links, inward and outward, in created variables
  • using text functions, remove the one you want to remove from the variables
  • use the Delete Links issue action to remove them all
  • Re-fetch the issue
  • add back in the links you want to keep

Kind regards,
Bill

Sam Hepworth
Contributor
August 30, 2023

Thanks, Bill. It is an interesting workaround :) As you mention I will create a lot of changes/noise, and there is a risk of losing links if the automation fails. I hope there is another way to do it, but thanks for the creative suggestion :)

Like # people like this
0 votes
Marc - Devoteam
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 30, 2023

Hi @Sam Hepworth 

Welcome to the community.

I'm not sure but can you try to replace "remove" with "del"

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