Forums

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

Need help with Automation Smart Values

Mark Ewart February 24, 2021

I am working on an objective-ish valuation calculation for projects (epics).

I have cusom fields that I need to sum up. I need to update a seperate field with that value.

In some cases, I need to take a string and pull the first 2 characters as a number.

I have searched youtube and the atlassian domumentation to no avail.

 

Are there training materials that illustrate hows to do this?  

 

2 answers

1 accepted

3 votes
Answer accepted
Kian Stack Mumo Systems
Community Champion
February 24, 2021

@Mark Ewart

Can you explain the use case just a bit more? Maybe some sample values you need to sum up?

Thanks,

Kian

Mark Ewart February 25, 2021

I have two sets of custom fields that represent the breadth of impact and the depth of impact of a project (epic).  I multiply those two outputs together to get the final calculated value.

I used to do this in script runner but it overloaded my log files so I had to turn them off.

 

1st set of custom fields - Breadth of Impact variables:

Custom field (% Agencies)

Custom field (% Internal)

Custom field (% Marketplace)

Custom field (% Supply)

Custom field (Breadth of Impact Value)

 

Breadth of Impact Calculation

Custom field (% Agencies) + Custom field (% Internal) + Custom field (% Marketplace) + Custom field (% Supply) = Custom field (Breadth of Impact Value)

 

2nd set of custom fields - Depth of Impact variables:

Custom field (Corporate Alignment)   // = if no then 0, if yes then 2.0

Custom field (Standard/Diff)   //= if no then 0, if yes then 1.5

Custom field (Internal Vulnerability Reduction)   //= if no then 0, if yes then 2.0

Custom field (External Vulnerability Reduction)   //= if no then 0, if yes then 2.0

Custom field (Increased Revenue)   //= if no then 0, if yes then 2.0

Custom Field (Initiative)  //this is a string that has a two (2) digit leading number.  If none then 0, else 11-(left 2 characters from the string)

Custom field (Custom field (Depth of Impact Value)

 

Depth of Impact Calculation:

 

Custom field (Corporate Alignment)  + Custom field (Standard/Diff) + Custom field (Internal Vulnerability Reduction) + Custom field (External Vulnerability Reduction) + Custom field (Increased Revenue) + Custom Field (Initiative) = Custom field (Custom field (Depth of Impact Value)

 

Value Calculation Variables:

Custom field (Breadth of Impact Value)

Custom field (Custom field (Depth of Impact Value)

Custom field (Calculated Value)

 

Value Calculation:

Custom field (Breadth of Impact Value) * Custom field (Custom field (Depth of Impact Value) = Custom field (Calculated Value)

Kian Stack Mumo Systems
Community Champion
February 25, 2021

@Mark Ewart 

The Breadth of Impact calculation is fairly easy to do.

Create a new automation with the trigger of Field Value changed and set the fields to % Agencies, ect.

 

Use the Edit issue fields action and set the Breadth of Impact using the smart value as follows:

{{#=}}{{issue.% Agencies}} + {{issue.% internal}} + {{issue.% Marketplace}} + {{issue.% Supply}}{{/}}

 

The next one you posted is a little harder to do, but still workable. Try this:

 

  1. Create a new automation rule with the same trigger as before, and the fields that it listens for are the Corporate Alignment, ect custom fields that you defined earlier.
  2. Set up 6 actions of the Create variable type and define them all as 0. Doing this will allow you to default them to 0 and update them later in your rule if the field is populated.
    Screen Shot 2021-02-25 at 1.18.54 PM.png
  3. After creating a variable for each field, you'll need to create 6 If/Else conditions: Make sure they are if/else blocks so that if the fields are not populated the rule will finish running
    Screen Shot 2021-02-25 at 1.20.11 PM.png
  4. Each of these If/else blocks will check to see if the value exists. If it does, update the value of the variable as follows:
    Screen Shot 2021-02-25 at 1.21.44 PM.png
  5. The only one that will be different is the Initiative field you mentioned earlier. To check that one, you want to do an Advanced check and check to see if it begins with two numbers. You can do that like this:
    Screen Shot 2021-02-25 at 1.22.48 PM.png
  6. Then, to set the value for the initiative variable you should have defined earlier set up the action as follows:
    Screen Shot 2021-02-25 at 1.23.56 PM.png
  7. Finally, after all of your If/else blocks, set the value of your Depth of Impact field with the following smart value:

 

{{#=}}{{corpAlignment}} + {{standard}} + {{ivr}} + {{evr}} + {{increasedRevenue}} + {{initiative}}{{/}}

 

Note: Please pay careful attention to the spelling or else it won't work. It took my a few tries to get all the spelling right and it working, so try it a few times if you're having trouble with it!

Mark Ewart February 25, 2021

I thank you, my company thanks you and my wife thanks as I have spent many sleepless nights working on this!

 

Stay tuned!

Mark Ewart February 25, 2021

I am getting this error right out of the gate:

Error while parsing additional fields. Not valid JSON.

2021-02-25_13-30-38.png

Kian Stack Mumo Systems
Community Champion
February 25, 2021

Put the smart value in the Breadth of Impact instead. 

 

Screen Shot 2021-02-25 at 2.36.45 PM.png

Like Mark Ewart likes this
Mark Ewart February 25, 2021

Success...

Now the hard part!  :)

Mark Ewart February 25, 2021

Getting the following error:

Round 2.png

 

 

Here is how I have the rule layed out in case I have it wrong:

Round 2b.png

Kian Stack Mumo Systems
Community Champion
February 25, 2021

@Mark Ewart

You missed the very first step. You first need to define the variables so that they'll be available when you perform your calculation at the very bottom. So first define all the variables you want to use, and then use the If/Else blocks to set the values if they are populated.

Does that make sense?

Thanks!

Kian

Like Mark Ewart likes this
Mark Ewart February 26, 2021

Are you sick of me yet!?
It does make sense.  Thank you!  Sorry for being such a newb!  :) 

I fixed that error and now I am getting:

Edit issue

Error rendering smart-values when executing this rule:Unknown operator or function: ADKOM: 1 - ADKOM/Agencies + 0 + 1.5 + 2 + 0 + 0 + 0

 

2021-02-26_9-26-51.png

Kian Stack Mumo Systems
Community Champion
February 26, 2021

@Mark Ewart

I  don't see where Adcom/Agencies is coming from. Can you tell me please? Is that the initative the ticket is tied to?

Mark Ewart February 26, 2021

Yes.  That is the Initiative.

Kian Stack Mumo Systems
Community Champion
February 26, 2021

Can you show how you defined the variables for that? It appears that its pulling the whole value. Given that it doesn't appear to have any numbers at the front,  it should not be setting that as the value.

What is your initial value set to for the Initiative variable?  It should be set to 0.

Mark Ewart February 26, 2021

This is the Variable in the If Block:

2021-02-26_11-52-46.png

 

The initial value is set to 0

2021-02-26_11-55-25.png

Kian Stack Mumo Systems
Community Champion
February 26, 2021

Your smart value setting is wrong.

Try this:


{{issue.initiative.match("([0-9]{2}).*")}}
Mark Ewart February 26, 2021

The Atlassian gods hate me.
Same error.

Kian Stack Mumo Systems
Community Champion
February 26, 2021

I'm sorry that it isn't working. Keep playing around with it! I'm sure you'll be able to get it soon!

Thanks,

Kian

Like # people like this
Boris Zozoulia
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.
September 16, 2021

Awesome effort @Kian Stack Mumo Systems 

Kian Stack Mumo Systems
Community Champion
September 16, 2021

@Mark Ewart

Did you  ever get this working?

Thanks,

Kian

0 votes
John Funk
Community Champion
February 25, 2021

Hi Mark - You can use Automation For Jira to take a stab at that.

You might need multiple number type custom fields though if you need to convert a string to another number first. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events