Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Trying to update a field with Automation that mostly works

Bobby Williams May 13, 2024

EDITED to update the problem:

 

I am using some automation rules documented on this site to update my Epic value for {{worklog.timeSpent}}.

It DID NOT work as shown in several submissions in my Cloud environment.

The accepted answer is actually to get the rules to work to update the Epic Values.

I will open a new question about calculating my "% Complete" custom field, if I have additional questions related to that.

BELOW IS NO LONGER RELEVANT TO THIS QUESTION.

Since that worked, I am now trying to update another field (custom field that I created) called "% Complete". I realize that there is a % done field, but it uses tasks completed instead of time.

Anyway, I am not getting the syntax correct on the math. Can someone help me with the syntax?

{{#=}} ( {{worklog.timeSpent}} * 100 ) /

( {{timetracking.originalestimate}} - {{worklog.timeSpent}} ) {{/}}

 

5 answers

2 accepted

0 votes
Answer accepted
Bobby Williams May 16, 2024

After getting my Epic work log to work, I focused on getting my custom field "% Complete" to update. 

This is only triggered now on a comment update as I was troubleshooting the syntax. I will put the correct trigger in place (or maybe cron) to initiate.

The Add value to the audit log has the calculation.

The Add to Rule to Update % Complete calculations.jpg

 

0 votes
Answer accepted
Bobby Williams May 15, 2024

I got the Epic work log script to work by using 2 scripts. 

They are pretty much identical, with one being initiated by a sub-task to update the work log on the parent story.

The other being initiated by the story to update the work log on the parent Epic.

The story initiated rule has "Check to allow other rule actions to trigger this rule. Only enable this if you need this rule to execute in response to another rule." box checked.

Rule to update the Epic work log from a Story update.jpgRule to update the Story work log from a sub-task update.jpg

0 votes
Bobby Williams May 15, 2024

@Kalyan Sattaluri @Bill Sheboy 

Sorry for the delay, but I found out that my automation wasn't working for summing up the total logged work into the Epic. I am using the flows from several articles in the community, but it doesn't work when work is added to a sub-task which adds to the story, but not the Epic.

If I manually add time to the Story, the epic is updated. My calculations above are not even being considered by automation.

I am now back to troubleshooting the automation to update the Epic with time logged on a sub-task of a story.

Audit log showing that a story triggers the rule, but not a sub-task of the story.jpgAutomation flow diagram.jpg

Kalyan Sattaluri
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.
May 15, 2024

Hello @Bobby Williams 

Usually, this is a symptom of you not referencing correct field.

What I mean is, in your Jira set up, you have 2 or more fields of the same name "worklog".

You need to find the customfield value and use that name to update, instead of {{worklog.timespent}}.

So to trouble shoot and find the correct customfield value:

  • Log into your Jira, find Issue key where you have manually entered this time spent. (say its ABC-123)
  • Open new browser Tab in same session, and put in below URL, replacing bolded parts
  • https://yourdomain.net/rest/api/2/issue/ABC-123?expand=names
  • Once you see response, inspect the JSON and find the customfield name which holds the value you have entered for the issue.
  • Then use that field to update your epic in your automation. It should be of the format customfield_xxxx, so you will use {{customfield_xxxx.timeSpent}}.

Hope it helps.

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.
May 15, 2024

As written, I would not expect that rule to update a Story when work is logged for a Subtask.  The reason is the branch is to Epic (parent), and Subtasks do not have an Epic for a parent.

Like Bobby Williams likes this
Kalyan Sattaluri
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.
May 15, 2024

^^. Thanks Bill.

@Bobby Williams  - Please clearly state what are you trying to do and what is working.

I thought your sub-tasks -> story update was working and story->Epic is not.

But now that I reread your post, I am confused if thats even the case.

So please clearly state what is working and what next are you are trying to do before going to deep.

Also, This topic has been covered pretty well in the forums. If you are referencing a particular post, share that link as well. 

 

Bobby Williams May 15, 2024

As shown in the rule diagram above, if I manually add work log time to a story, the Epic work log gets updated.

However, if I add time to a sub-task, the story gets updated (include child issues is checked), but the Epic doesn't get updated.

It would seem that if the Story worklog get updated, either manually or cumulatively, then the Epic would update its worklog.

Manually adding time to the Story will update the Epic worklog.

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.
May 13, 2024

Hi @Bobby Williams -- Welcome to the Atlassian Community!

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected.  Those will provide context for the community to offer ideas.  Thanks!

Until we see those...

Some of those smart values you are using are the output-formatted ones for time tracking and not numbers.  For example, I believe the one to use for original estimate in a math expression is this:

{{issue.timetracking.originalEstimateSeconds}}

Please confirm the smart values you are using are numbers.

Kind regards,
Bill

Bobby Williams May 13, 2024

I apologize for the lack of documents and screenshots.

I am a newbie in this forum, but should know better :( 

I will do better.

0 votes
Kalyan Sattaluri
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.
May 13, 2024

Hello @Bobby Williams 

Your syntax as you have listed is fine but why isnt it resolving to a value?

We dont know.

You havent shared your rule screenshot or audit log.

Please log all these smart values outside/before the calculation step, run the rule and share the rule/audit log so community can help.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events