Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,551,714
Community Members
 
Community Events
184
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

1 accepted

0 votes
Answer accepted
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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.

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jul 06, 2022

Hi @Robert Valentine 

I couldn´t solve this with smart value only. I guess the point is that within the iteration only the field that is iterated is in context to deliver data.

AND:
assuming I got your requirement right you´d like to iterate over the multi-select field and for each value in there write that value and add the value of the other single select field. Please correct me if I´m wrong.

If this is the case I tried solve this with a for each branch (see screenshot):

image.pngimage.png

I hope this is helpful to solve your problem.

Looking forward to your feedback.

 

Best
Stefan

This might work in a multistage setup if I can concatenate all the results back down.

The end use case is to shove this information into a custom payload for a webrequest.

So presumably, anytime one of the values changed for either dropdown I would have to recalculate the values and put them into another custom field or temporary storage location.

I just don't know how to threadsafe the advanced branching.

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jul 06, 2022

sorry but can‘t follow your idea...

your rule will always only be calculated when triggered.

So I‘m sure you could concatenate the result with split and concatenate.

Best
Stefan

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jul 06, 2022

Please also provide a screenshot of your whole automation rule? This eould be very helpful (for me as well as for other answerers) to understand the whole context.

Best
Stefan

Below is what the web request looks like in the intended flow.

web_request.JPG

 

It is triggered like so...

incident_flow.JPG

 

In order to use branching, I would have to branch, save the results of each of the branches somewhere, then concatenate them back together when creating the web request.

The thread safety of branching is in question.

Because if I made a branch that...

  1. calculated the string I wanted for one multiselect option
  2. grabbed a custom field text box's value
  3. added the string to said value
  4. assigned it back to the custom field

Then if it's not thread safe, the string may get grabbed between steps 2 and 3 by another thread.

This would result in incorrect results in said custom field before all branches resolve.

James Navin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jul 10, 2022

Hi there,

@Stefan Salzl is correct that at the moment the context within the iteration doesn't have access to the originating issue (e.g. it is restricted to the loop context). I have raised an issue to look at adding it - https://jira.atlassian.com/browse/JSWCLOUD-23239

In the meantime, you could try to reform the iteration as a mapping over the collection. Something like:

{{issue."Affected Status Page Components".value.split("#").get(1).concat(":").concat(issue."Status Page Component Status")}}

Hope that helps.

Cheers,

James

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jul 11, 2022

Hi @James Navin 

thanks for the great input and the approval of my assumption :) I was also thinking of the .concat method but wasn´t able to do. Thanks for the hint. Always great to learn things here :)

Best
Stefan

Wish I could highlight the helpful parts of the comment chain.
I'll try and take a look at that answer when I get a chance, I know I tried a bunch of things, but maybe not that one.

Like Stefan Salzl likes this

That one didn't do it for me.
I think I need to be able to actively iterate through the multiselect for this process.

But the issue report is an answer.

Suggest an answer

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

Atlassian Community Events