Hello,
I'm currently running the below automation, which outputs the user ID of a user mentioned in a comment like this :
"accountid:123a456b7891be664"
I'd like to change update a custom user picker field with the account id that has been extracted from this, I can change the JSON to add or remove bits around the string, however I haven't been able to get the custom user picker field to accept anything I've thrown at it so far.
The regex that finds the accountid is :
\[~accountid:.+\]
And the JSON is :
{
"update": {
"customfield_10633": [{
"set": "{{issue.comments.last.body.match("(\[~accountid:.+\])").remove("[~").remove("]")}}"
}]
}
}
Any ideas on what I'm doing wrong here?
Hi @Evan Nixon
Please try:
{
"update": {
"customfield_10633": [{
"accountid": "{{issue.comments.last.body.match("(\[~accountid:.+\])").remove("[~").remove("]")}}"
}]
}
}
All needed informations how to set fields via api you can find here: https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/
Hi Sebastian,
Thanks very much for your reply - super appreciated as I'm absolutely banging my head against a wall on this one, unfortunately there's no luck with your suggestion either. Below is your snippet and the error it threw, then my attempt to tweak it with it's failure log as well. Just a heads up that customfield_10632 the correct value for my custom multi-user picker, whereas my original post had 10633 which is a custom rich text field I've been using to test the output. I ran both of the below through both fields and got no results.
{
"update": {
"customfield_10632": [{
"accountid": "{{issue.comments.last.body.match("(\[~accountid:.+\])").remove("[~").remove("]")}}"
}]
}
}
{
"update": {
"customfield_10632": [{
"set": "{{issue.comments.last.body.match("(\[~accountid:.+\])").remove("[~").remove("]")}}"
}]
}
}
I've tested just the below part of the code just to double check
"{{issue.comments.last.body.match("(\[~accountid:.+\])").remove("[~").remove("]")}}"
It's output is :
accountid:[...]
I'm still not confident I know if that's the right syntax for the multi-user picker box, if it needs to be wrapped in {{ }}, or even if there's a way to instead use the {{user.key}} instead of the accountid string. Man this stuff can be difficult.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you share example input that you have?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Sebastian Krzewiński I ended up getting past this particular stumbling block, but am now stuck at the very last hurdle. I've given a fair bit more information in this thread regarding the input, output, regex and multi-user picker syntax. Any help you can provide there would be fantastic, cheers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.