Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,293,317
Community Members
 
Community Events
165
Community Groups

Referencing the original issue when inside #issue."customfield" not working.

I'm having trouble referencing the triggering issue when creating a web request for Status Page using smart fields as part of Jira Cloud Automation.

 

The code  I'm using is below.

{{#issue."Affected Status Page Components"}} "{{value.split("#").get(1)}}": "{{issue."Status Page Component Status"}}"{{^last}}, {{/}}{{/}}

 

The broken portion is the "{{issue."Status Page Component Status"}}"

It results in a value of ""

Inputting a static string works but is undesirable

 

I've tried some of the following.

  • triggerIssue."Status Page Component Status"
  • parent.Issue."Status Page Component Status"
  • parent."Status Page Component Status"

1 answer

0 votes
Stefan Salzl Community Leader Jun 22, 2022

Hi @Robert Valentine ,

for deeper understanding of your problem:

Could you please describe in more details/from a use case perspective what the automation rule is trying to solve? Furthetmore a screenshot of the current automation rule would be helpful to get an overview.

Is „Status Page Component Status“ a custom field in your issue? Have you tried to select the customfiel without ““? I only know the notation {{issue.customFiel}} (eg. {{issue.description}} ).

 

Best
Stefan

"{{issue."Status Page Component Status"}}"

This is referencing a custom field, yes.

This works fine in a comment.

This works fine in the webhook custom payload normally.

 

However, in the context of, {{#issue."Affected Status Page Components"}} "{{value.split("#").get(1)}}": "{{issue."Status Page Component Status"}}"{{^last}}, {{/}}{{/}}
It does not work.

 

The expected result is:

"component name": "component status", "component name": "component status"

 

The actual result is:

"component name": "", "component name": ""

 

As a breakdown of the line's inputs/outputs....

 {{#issue."Affected Status Page Components"}}

This is a multiple select list. The contents look similar to this.

component name #shjkdfhjk287376

component name #82h891h43987

 

We printing all of the selected contents of this field using this line

See: https://support.atlassian.com/cloud-automation/docs/examples-of-using-smart-values-with-lists/

 

The following is basically composing a string with a bit of a foreach as per the documentation.

"{{value.split("#").get(1)}}":

Here we split the value, and get the first result, this is the component ID of the component in Status Page.  It then wraps it in quotes and ends it with a colon.

See: https://community.atlassian.com/t5/Marketplace-Apps-Integrations/JIRA-Automation-How-to-use-Smart-Fields-split-function/qaq-p/700234

 

Still in the loop

This is the broken part, the rest works 100% fine.

"{{issue."Status Page Component Status"}}"

This should reference the value of the issue's custom field Status Page Component Status

This is a single value select list. It is used to determine the severity of the impact on all the selected components. It is then wrapped in quotes.

Basic referencing as per: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/

 

{{^last}}, {{/}}{{/}}

This means except for the last value, set a , after everything else before it.

I believe the {{/}} is some kind of logic ending symbol, but I just copied it from the instructions in the documentation see using lists.

 

The net result is a subset of a web request that lists the components, and gives them a severity of impact. In this case, they will all be set to the same severity. This is put into the rest of a web request that updates a status page with an incident that actually updates component statuses.

 

To reiterate, all other code works but that section, which appears to be broken as I am referencing the issue during, what I can only imagine is another context of code.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you