Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use function in JSON?

Oxana Z February 4, 2022

I would like to update a custom field by value. But this value must be the number of the current sprint. Is this the correct syntax for JSON or should it be different? If yes, could you help me. Thanks in advance.

==================

{
"update": {
"customfield_12810": [
{
"set": "openSprints()"
}
]
}
}

2 answers

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 4, 2022

Hi @Oxana Z -- Welcome to the Atlassian Community!

What problem are you trying to solve by doing this?

And...for a question like this, please consider posting an image of your automation rule...or if instead you are calling the REST API directly, describe which method you are calling. 

Providing that information will give context for the community to offer suggestions.  Thanks!

Kind regards,
Bill

Oxana Z February 6, 2022

Thank you, Bill

I need to fill in the custom field "Sprint" by value of the current Sprint if field "Team"="my team name."

The rule is very easy.

Thanks you in advance.

Oxana.

image.png

 

image.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 7, 2022

Thanks for posting those images of the rule.

First thing: it may not be a good idea to automatically add items to the active sprint.  That could cause some visibility and other unintended consequence problems.

Next to your rule: your schedule trigger finds the issues that you want to update.  That branch is both unnecessary and will not find the current issue.  Instead consider this approach:

  • run your rule on a schedule with no JQL
  • use the lookup issues action to identify any issue in openSprints() with JQL
  • now use a branch on your original JQL to select the issues to update...and use the sprint id found in the lookup to edit them
0 votes
Pedram Mireftekhari
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 4, 2022

not sure if it is possible with JSON but why do not you use the smart value {{sprint.id}} on the field?

Here is the list of all smart values for Sprint: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/ 

Oxana Z February 6, 2022

As I undestand, the smart value show the value which already in the field, but in my case I would like to add the value of current in this moment Sprint to the field "Sprint". May be I am wrong?

Thanks.

Oxana.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events