I am trying to edit the Advanced Roadmap TEAM field. I can use the following without error as a LOG action:
Parent team {{triggerissue.customfield_13100}}, story team {{issue.customfield_13100}}
But, when I try to set a field value (I want to copy the value of the custom field in the trigger issue), I get a "not valid json" error.
{ "fields":
{ "customfield_13100": {{triggerissue.fields.customfield_13100.value}}
}
}
When I add quotes around the trigger issue, then I get an error that the field does not exist.
{ "fields":
{ "customfield_13100": " {{triggerissue.fields.customfield_13100.value}} "
}
}
I cannot use the standard edit issue and select the field because the Team field from Advanced Roadmaps is not available. Remember, there are TWO Team fields in Jira now, if you use Advanced Roadmaps.
Hi @David Wuth
I have not edited fields in the automation rules using JSON yet... I did look over the documentation and I wonder if there is an issue with how the automation is parsing within the quotation marks for the fields: https://support.atlassian.com/jira-core-cloud/docs/advanced-field-editing-json/
I saw one posting that used a method similar to you, but did not have the extra spaces within the quoted value:
{ "fields":
{ "customfield_13100": "{{triggerIssue.fields.customfield_13100.value}}"
}
}
The documentation also shows examples using the function asJsonString, maybe something like this:
{ "fields":
{ "customfield_13100": {{triggerIssue.fields.customfield_13100.asJsonString}}
}
}
Maybe try those to see if they help.
Best regards,
Bill
Thanks, @Bill Sheboy ! The issue was the space before/after the quote marks. Now, I still had to modify the json a bit more to get it to do what I wanted. The final key change was using the ID of the custom field, not the VALUE. Here is the final working json:
{"fields":
{"customfield_13100": "{{triggerissue.fields.customfield_13100.id}}"
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have similar issue as yours. I used the same JSAN you mentioned but I got below error
Can not deserialize instance of com.atlassian.jira.issue.fields.rest.json.beans.CustomFieldOptionJsonBean out of START_ARRAY token at [Source: N/A; line: -1, column: -1] (customfield_10958)
My automation rule is manually executed from an Epic. The custom field in the triggering Epic is a drop down field. So I tried below
{"fields":
{"customfield_13100": ["{{triggerissue.fields.customfield_13100.id}}"]
}
}
and got below error
Can not deserialize instance of com.atlassian.jira.issue.fields.rest.json.beans.CustomFieldOptionJsonBean out of START_ARRAY token at [Source: N/A; line: -1, column: -1] (customfield_10958)
I tried without [
{"fields":
{"customfield_13100": "{{triggerissue.fields.customfield_13100.id}}"
}
}
Can not instantiate value of type [simple type, class com.atlassian.jira.issue.fields.rest.json.beans.CustomFieldOptionJsonBean] from JSON String; no single-String constructor/factory method (customfield_10958)
So any idea what's wrong in my Json ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What type of field is your custom field? Mine was a string, which is why I enclosed it in quotes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's a drop down field with 4 values. that's why I tried to add [
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Maha Eltemsah I've not tried json with arrays, but based on this article (https://support.atlassian.com/jira-software-cloud/docs/smart-values-json-functions/) you might need to use the asJsonObjectArray function
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I originally got to the solution using the asJsonObjectString function. It works as long as your not clearing the field. When that happens, you will get an error. I think because the asjsonfunction never fires.
I changed my solution to using the surrounding quotes because of this, and it works. I did not try the asJsonObjectArray.
Original solution (fails when trigger field is cleared):
{
"fields": {
"Team": "{{triggerIssue.fields.team.id.asjs}}"
}
}
The solution that works for me (Same as above):
{
"fields": {
"Team": "{{triggerIssue.fields.team.id}}"
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was able to get this work.
{
"fields": {"team": "{{issue.parent.team.id}}"}
}
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.