Forums

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

Automation make calculation (beginner)

Martin
Contributor
February 22, 2022

Hi there,

I'm new to programming. I am doing a lot of automation for my company and now I need to take it to the next level.

I'm trying to figure out how the JSON automation works but some (probably) basic concepts don't reach me.

What I am looking to do here is to take a customer field value, multiply it by a number, then add another custom field value and store it into a field. As simple as that.

usually I get around these kind of issues in my life pretty easilly but this one, I don't seam to find where to start.

I do have the field numbers (or name).

 

Thanks for your help

1 answer

1 accepted

2 votes
Answer accepted
Melo
Community Champion
February 22, 2022

Hi @Martin,

I usually use automation for Jira for simple operations like the one you're describing.  

You can follow the "Multiply" example in the documentation below

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/#Multiply

Please let me know if that helped.

Cheers,

Melo

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 23, 2022

Hi @Martin 

Yes, and...to what Melo suggests: Please try the way the math operations are described in the documentation.  Some other things to try if that does not work are:

  • Check your field types, and if the field is text, you may need to convert with asNumber in order to perform math operations.  For example: {{issue.Story points.asNumber}}
  • If your field is in an option list, those are objects and have a value, an ID, etc.  For such field types try to use the value in a math operation.  {{issue.myOptionField.value}}

Kind regards,
Bill

Like Stefan Salzl likes this
Martin
Contributor
February 24, 2022

Thank you guys,

 

I saw the documentation but what I am looking is learning the basics of coding in this. For exemple: why do I have to add the {{ and where to put them... things like that.

 

I know how to find the custom fields number, I like to dig around. What I need here is just a tip on where to start my learning.

 

Thanks for replying! I really appreciate your support.

Martin

Stefan Salzl
Community Champion
February 24, 2022

Hi @Martin ,

I was quite new to coding and jira automation too. Personally I started with reeeeaaally easy examples in jira automation, doing some examples from the community (like closing a story when all subtasks are done, transition a story to "in progress" when the first subtask moves to "in progress",...) After some examples, reading quite a lot here in the community and getting deeper into automation I got in contact with smart values (kind of "accidently" :D ). I can´t tell you exactly "why" the {{ }} but reading through and trying out the above mentioned documentation helped me a lot. You´ll get familiar to the format while trying out ;)

Best
Stefan

Like Taranjeet Singh likes this

Suggest an answer

Log in or Sign up to answer