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?
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
Thank you so much! It is very helpful!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.