Hi
I am trying to use automation when an issue is created, to set the assignee and edit another user picker field with values from 2 user picker fields in a linked issue.
I am creating 2 variables, setting the values to them in a linked issue branch, then coming back to the main line to assign and edit the created issue.
The assigning part works fine. But I can't get the edit of the other field working. The error I'm getting is invalid JSON.
I've tried a few different ways (the variable is called pm):
{
"fields": {
"customfield_16457": {{pm}}
},
}
{
"fields": {
"customfield_16457": {{pm.accountId.asJsonObject("id")}}
},
}
What should the JSON be when using a variable? Or is this a case where a variable will not work?
Hi @Gareth Cantrell and @Darryl Lee
I was not able to use the smart value in the basic edit - it seemed not to recognise the variable as a smart value.
Hi @Sam Harding
Thanks for spotting the trailing comma. Another problem with my JSON was that I didn't have "" around the smart value.
But this did not solve the problem.
It turned out that the variable was the account id, so the solution that worked was this:
{
"fields": {
"customfield_16457": { "id": "{{pm}}" }
}
}
Thanks all for your suggestions.
Hi @Julia Foden
The answers suggested by the others in this thread are good advice, and I recommend following their suggestions. In your particular case, the reason it is not valid JSON is because of the trailing commas after your 'fields' entry. Removing the commas will make the JSON valid.
Cheers
Sam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Julia Foden
It would be easier to select the field to edit from the Edit issues configure screen and use the smart value directly.
If you must use the Advanced editor, the JSON should have a single "fields" key with all the fields listed inside as follows:
{
"fields": {
"customfield_1234": "...",
"customfield_5678": "..."
}
}
Also, as @Darryl Lee mentioned in this thread, you could also use a JSON validator such as https://jsonlint.com/ to validate your JSON.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Agree with Gareth - I believe you should be able to use {{pm.accountId}} in the Basic Edit function without having to deal with JSON at all:
The UI is a bit fiddly though:
You have to start typing {{ for it to show that Smart values are valid there.
Also, I don't think you'll need to use asJsonObject("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.