I'm trying to get my head around json and failing miserably.
I have a custom field which is a drop-down list, that contains the values 0-36 & "> 3 years"
I want to run an automation comparing today's date with the date in another field and update the field with the calculated value.
customfield_12047 is the field holding the date to compare to.
customfield_12095 is the field I need to set 'Months open after agreed remediation date'.
It's easy enough with the gui to have the if "{{issue.customfield_12047.diff(now).months}} is greater than 36" then set the field value to ">3 years"
Less than 37 requires the JSON. This is as close as I've got but I'm obviously doing something fundamentally wrong.
{ "fields": { "customfield_12095": "customfield_12047.diff(now).months" } }
When run, the audit trail throws the error
Specify a valid 'id' or 'name' for Months open after agreed remediation date (customfield_12095))
Tips, tricks, pointers gratefully received (and yes, I think I have the logic right to cope with less than zero :) )
tks
Hello @Peter Degotardi
Welcome to the Atlassian community.
Reviewing this page
https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/
...for the details on setting a Single-select Custom Field, you should use code like this:
{
"fields": {
"customfield_12095" : {
"value": "{customfield_12097.diff(now).months}" }
}
}
Thanks! That's let me move on from the id error to :
Specify a valid value for Months open after agreed remediation date (customfield_12095)
Again, any pointers appreciated.
The if rule looks ok. The other rules for >1, >2, >3 years work (I'm still fiddling and have changed the numbers from when I first posed)
The JSON seems right.
The dropdown as defined
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you please provide screen images that show the entire rule and the details of the audit log for execution of the rule?
I would also recommend that you use the Log action to print to the log the value of the smart value you're trying to use in the JSON.
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.