how to use a conditional smart value

ben friedman June 13, 2021

Hi, 

i need to edit a value based on a smart value result.

i have an edit action where

{{#issue.issuelinks}}{{#if{{equals(type,"blocks")}} {{inwardissue.key}}{{/}}{{/}}

 

however, the condition isnt working!!

i tried it as simple as {{#if{{equals("2","2")}} x {{/}} and couldnt get to print x. 

where am i missing it?

2 answers

3 votes
Hauke Bruno Wollentin June 25, 2021

@ben friedman absolutely no idea why, but you need to add spaces in front of `if` and the closing `/`

{{ #if{{equals("2","2")}} x {{ /}}

A comment in the following article led me to this strange one: https://community.atlassian.com/t5/Automation-articles/New-automation-smart-values-in-Jira-Cloud/ba-p/1402775 

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.
June 25, 2021

Hi @Hauke Bruno Wollentin  -- Welcome to the Atlassian Community!

Thanks for that reminder about the spacing, and... your link seems to have some extra chars making it fail.  Here's one that works:

https://community.atlassian.com/t5/Automation-articles/New-automation-smart-values-in-Jira-Cloud/ba-p/1402775

 

Best regards,
Bill

0 votes
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.
June 14, 2021

Hi @ben friedman 

Based upon the way the JSON/smart values are structured for links, I am unclear how you can do that directly in conditional logic: the link type appears to be in a separate node above the list of linked issues.  You might be able to use string functions to put the entire string into a created variable and then use string functions with a regular expression to parse it.

Or...have you considered  using JQL with LookupIssues, and then test the count/process the remaining issues?  Something like:

issue IN linkedIssues({{issue.key}}, "blocks")

 

Best regards,

Bill

Suggest an answer

Log in or Sign up to answer