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.
I'm trying to create an automation that would set custom field "Story points number" to the value of built-in field "Estimate[Number]", using code like this:
{
"fields": {
"Story point estimate": {{issue.Estimate.asNumber}}
}
}
But it doesn't work.
I've tried multiple variations, e.g.
{
"fields": {
"Story point estimate": {"id":"{{issue.Estimate[Number].asNumber}}"}
}
}
But always end up with JSON parsing error ("Error while parsing additional fields. Not valid JSON.") or with an error saying value is not a number ("ES-341 (Specify a number for the custom field (below 100,000,000,000,000) (customfield_10016))")
I've tried different variations with and without [Number] part in field name, using {"id":"{{issue.Estimate.asNumber}}"} etc - nothing worked.
I'm also not sure why "Story point estimate" is a custom field - I didn't create it, it appeared after I enabled "Estimates" feature.
What I actually need to do is to copy story point estimates from existing "Estimate" field to this new field/
Hi @Mykola Makhin and welcome to the community,
Best way is to use smart values.
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/
https://support.atlassian.com/cloud-automation/docs/examples-of-using-math-expression-smart-values/
Not sure what do you mean by "use smart values" here - I already tried "{{issue.Estimate[Number].asNumber}}"
It didn't work.
How exactly should I use these smart values in this case?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry @Mykola Makhin didn't see that you had already used smart values :(
Are you on CMP or TMP?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
TMP
Also I found out that Estimate is a custom field too - by sorting on it. It's cf[10067], while Story point estimate is a cf[10016].
So basically I need to copy value of one numeric custom field into another numeric custom field.
But, code like this:
{
"fields": {
"Story point estimate": {"id":"{{issue.[10067].value}}"}
}
}
results in error (Specify a number for the custom field (below 100,000,000,000,000) (customfield_10016))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
On my instance story points estimate is going by a customfield number.
It worked for me like this:
{
"fields": {
"customfield_10016": 50
}
}
And hold on, I'll give you the proper smart value as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It'll work for constant for sure. But what I really need is not a constant, but a value of another numeric custom field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
{
"fields": {
"customfield_10016": {{issue.fields.Number}}
}
}
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.
You should add on your rule a log component and see what your smart values return.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the
{{issue.fields.Number}}
what is "fields"? Is that a name of your custom field?
My custom field name is "Estimate", cf[10067].
How do I specify that?
For some reason just putting {{smart field}} without "" results in JSON parsing error, e.g.
{
"fields": {
"Story point estimate": {{issue.Estimate.Number}}
}
}
returns "Error while parsing additional fields. Not valid JSON."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"Fields" is another way of getting the values of custom fields. If you take a look at the JSON payload, you'll see that all fields are nested below the "fields". Just type {{issue.fields.Estimate}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's not mentioned in https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#Available-properties , but this way it works.
Thank you!
This worked for me:
{
"fields": {
"Story point estimate": {{issue.fields.Estimate}}
}
}
also this worked too, but I find this option less readable
{
"fields": {
"customfield_10016": {{issue.fields.Estimate}}
}
}
Anyhow, thanks again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good to know that it worked!
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.