You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello everyone!
I'm trying to set custom user field "Engineer" (user picker, used afterwards for several automation rules) from Assignee value on an issue transition. I've tried using several smart values options, this one seemed to be correct:
{
"fields": {
"engineer": [{
"set": {{initiator.accountId.asJsonObject("id")}}
}]
}
}
(yes, i've tried setting "customfield_XXX" instead "engineer" and it doesn't help)
And this still doesn't work (it says SUCCESS in Audit log, but the field itself is empty. I've already tried adding re-fetch action after changing "Engineer" field - it still doesn't help.
I hope someone will be able to help me out
What return {{initiator.accountId.asJsonObject("id")}}? Add Log action to your rule and put it there and see what it returns.
Regards,
Seba
Hi @Sebastian Krzewiński !
Thank you for your response! As expected, it returns json with user id:
{ "id": "615c4edd72f697006957659c" }
But I guess that what needs to be set to user picker is a full json with id, name, etc. I'll look through the documentation for json functions, try to use and right back later
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, I haven't found a way to get full user json as it's represented in API. I can only access:
separately. And I don't get what should I put into user picker custom field via smart values :(
I've also tried to log what's inside this custom field and it's just an accountId, it's not a json. But setting id as a string doesn't help either.
So I don't know how to make it work
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hell yeah!
After about 50 tries, I've found the right option! Here it is:
{
"fields": {
"engineer": { "id": "{{assignee.accountId}}" }
}
}
This does work for me. I hope it'll help someone :)
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.
Hi all,
Glad to see you found the solution. Just for a future note, a problem with the smart value used in the question, is that when using the set format of
{"set": <SOME_VALUE>}
it must use the update clause (not the fields clause). So it would need to be
{
"update": {
"engineer": [{
"set": {{initiator.accountId.asJsonObject("id")}}
}]
}
}
When using the fields clause, you need to supply the direct mapping to the value, just like you have done in your answer. I hope that helps!
Cheers
Sam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Sam Harding Hello
I've tried using update: field: set construction. But in that case Automation drops an error saying something like "Field 'Engineer' can't be both in 'fields' and 'update'". So I guess that this option doesn't work with custom fields
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.