Forums

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

smartvalue conditional logic in JSON parsing

Elyashiv Grosser January 30, 2022

Hi,

I'm trying to clone an issue using Automation for Jira. I want the new issue to include all the links of linked-issues from the original issue.

This is not possible using the automation interface and may be possible using the "Additional fields" using JSON.

I tried already to use the "Additional fields" but I succeed in adding only 1 link from the original issue. If the original issue has more than 1 link - it seems that iteration over the {{issue.issuelinks}} doesn't work. 

Can someone help?

 

Attaching some of my solutions that didn't work:

{{#issue.issuelinks}}
{
"update": {
"issuelinks": [
{
"add": {
"type": {
"name": "{{type.name}}"
},
"outwardIssue": {
"key": "{{outwardIssue.key}}"
}
}
}
]
}
}
{{/}}
 
{{#issue.issuelinks}}
{
"update": {
"issuelinks": [
{
"add": {
"type": {
"name": "{{type.name}}"
},
"outwardIssue": {
"key": "{{outwardIssue.key}}"
},
"inwardIssue": {
"key": "{{inwardIssue.key}}"
}
}
}
]
}
}
{{/}}
 
{{#issue.issuelinks}}
{
"update": {
"issuelinks": [
{
"add": {
"type": {
"name": "{{type.name}}"
},
{{#if(outwardIssue)}}
"outwardIssue": {
"key": "{{outwardIssue.key}}"
},
{{/}}
{{#if(inwardIssue)}}
"inwardIssue": {
"key": "{{inwardIssue.key}}"
}
{{/}}
}
}
]
}
}
{{/}}
  

1 answer

1 accepted

2 votes
Answer accepted
Pramodh M
Community Champion
January 30, 2022

Hi @Elyashiv Grosser 

Welcome to the Community!!

Assuming the problem is statement is below

I want the new issue to include all the links of linked-issues from the original issue.

Can you try the below and let me know

Clone.png

Thanks,
Pramodh

Pramodh M
Community Champion
January 30, 2022

FYI, this is the option

Option.png

Elyashiv Grosser January 30, 2022

Hi!

I'm feeling so stupid, I didn't see that option.

Thank you very much!

I tried for a long time something with a such simple solution!

Like Pramodh M likes this
Pramodh M
Community Champion
January 30, 2022

It's okay No worries. @Elyashiv Grosser 

Every day there is so much to learn!!

Suggest an answer

Log in or Sign up to answer