Forums

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

Using Smart values in edit issue, additional fields section

Rupert Willis November 30, 2023

Hi,

I am trying to use a smart value in the edit issues action within automations to use a dynamic variable as the field to update but I keep getting an error about the field not being valid.

Basically I want to loop through values and save an id from a webhook response into different custom fields.

I have tried three methods all without success:

1) Creating a lookup table

{ "fields": { "{{lookuptable.get(value)}}": "{{webResponse.data.body.id}}" } }

2) Assign to a variable locally within the automation

{ "fields": { "{{localvariable}}": "{{webResponse.data.body.id}}" } }

3) Assign it to a field in the issue

{ "fields": { "{{issue.temp}}": "{{webResponse.data.body.id}}" } }

 

Does anyone in the community know if this is even possible?

Many thanks in advance,

Rupert

1 answer

1 accepted

0 votes
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.
November 30, 2023

Hi @Rupert Willis 

Context is important for automation rules.  For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected.  Those will provide context for the community to offer ideas.  Thanks!

Until we see those...

From what you describe, I believe you are trying to:

Based on data in a webhook response, update a variable list of custom fields using a JSON advanced edit expression.

If that is correct, I suspect this is possible and some key things would be:

Kind regards,
Bill

Rupert Willis November 30, 2023

Hi Bill,

Sort of. I am looking to get the id from a webhook response and assign it to its corresponding variable. I am looping through a checklist. Here are a few screenshot that may or may not help!

Rather than expand on them all I will go through the first example as they are essentially doing the same thing with me just thinking of different ways to try and achieve the same thing!

So for the first one I have a lookup table for the custom fields

Screenshot 2023-11-30 at 16.36.46.png

I then loop through the items in a check box list

Screenshot 2023-11-30 at 16.37.38.png

I want to edit the custom field associated with say LGW if has been selected, with the response from the webhook but I get this error. It can't find the smart value.

Screenshot 2023-11-30 at 16.44.20.png

but if I log it the value is correct

Screenshot 2023-11-30 at 16.45.30.png

Screenshot 2023-11-30 at 16.46.04.png

If I hardcode customfield_10959 in the edit issue JSON it works.

Does this help?

Many thanks,

Rupert

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.
November 30, 2023

Where is that log action: inside the branch?

Have you checked if there are any leading / trailing spaces around the return from the table get() results?  You could add a trim() to confirm that is not the problem.

 

UPDATED: 

I forgot that I had figured out this scenario before  :^)

The rule editor for the JSON edit tries to interpret that expression just-in-time...and so that error is it trying to parse, left-to-right, and so it does not evaluate the smart value for your field name before validating it.

The work-around: create your entire JSON expression in a variable, let's call it varJson, and then use only that in the advanced edit:

{{varJson}}

Like # people like this
Rupert Willis December 1, 2023

Thanks Bill. I will give that a try.

Rupert Willis December 1, 2023

That worked! 

Thank you so much Bill. I shall have to remember that little "feature"!

Thanks once again.

Like Bill Sheboy likes this
Florian Reichl February 24, 2025

@Bill Sheboy  I really like your approach. When I tried it with Organizations-Field, I keep running into: Invalid organization ids specified., Specify a valid value for Organizations ID (customfield_10002)

Like Bill Sheboy likes this

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