Forums

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

Using smart values in advanced field editing

Deleted user December 5, 2023

I am trying to set the value of the priority using the following method:

The priority is determined by the date now, which will be set as  "P" + the day%3. For example, the priority for 2023-10-01 will be P1 since 1%3 = 1, and the priority for 2023-10-15 will be P0 since 15%3 = 0.

I am using the following advanced field editing json

{
"fields": {
"priority": {"name":"P".concat({{#=}}{{now.shortDate.split("/").get(2).asNumber}}%3{{/}})}
}
}

And I got the following error

Edit issue
Error while parsing additional fields. Not valid JSON.

 

Can anyone help me to look into my json to see why it is invalid? 

1 answer

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.
December 5, 2023

Hi @[deleted] 

There are a couple of possible causes for what you are observing...

 

In your expression, you are trying to use the concat() function on a literal values of "P" and that is not possible.  The function can only be applied to a smart value.  The fix for that is to just remove the concat() completely:

{
"fields" : {
"priority" : {
"name" : "P{{#=}}{{now.shortDate.split("/").get(2).asNumber}}%3{{/}}"
}
}
}

Better still, you might want to use a Lookup Table for this type of operation to determine the priority based on a key value.

 

This symptom might also be caused by the JSON being validated prior to all of the smart values being parsed.

The work-around, and way to check that, is to use a Created Variable action to build all of your JSON first.  Let's name that one varJson.  You can write that to the audit log to confirm it parsed as you expected with {{varJson}}

And then in your advanced edit you would only need to add {{varJson}}

 

Kind regards,
Bill

Deleted user December 5, 2023

Thank you so much! It is very helpful!

Like Bill Sheboy likes this
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.
December 6, 2023

I am glad to learn that helped.  Did that resolve the question for you?  If so, please consider marking this one as "answered" so other community members with a similar need can find solutions faster.  Thanks!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events