Automate Log Work from Issue Transition Trigger Not Working

Jessica Rubeo July 30, 2024

Hi all! I'm working on an automation for auto work time logging that uses three separate fields in JIRA; two custom (listed below) and one native (Work Log).

The two custom date/time picker fields are "In Progress Start Time" and "Done Time". I have two separate automations that are triggered by the "Issue Transition" trigger that prints the {{now}} variable to the "In Progress Start Time"/"Done Time" fields when an issue is transitioned into "In Progress"/"Done". These two automations are functioning as expected and the date/time is being printed properly. 

My third automation is also being triggered by an "Issue Transition" from any status into the "Done" statuses: 

autoLogWork.PNG

I added a delay because I often get this error readout:

autoLogWork2.PNG

And I figured it was because the automation is running too quickly and the "Done Time" timestamp automation doesn't have enough time to register before the Work Log one runs, but this hasn't seemed to fix anything. I know the work log action works properly because if I then change the issue status from "Done" to "Canceled", for example, it accurately logs the time between the "In Progress Start" and the "Done Time" date/time picker fields.

It seems as though the automation is running too quickly for the Work Log action to function correctly, but I've reorganized and tried adding delays and whatnot; nothing seems to be working.

Any help would be very much appreciated!

2 answers

1 vote
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 30, 2024

Hello @Jessica Rubeo 

Welcome to the Atlassian community.

I believe the problem is in the smart value you have used in your Log Work step. Can you provide a screen image that shows all the details of that step, please?

Also, try adding the Log Action to write into rule execution audit log the exact smart value you are trying to use in the Log Work action.

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.
July 30, 2024

Hi @Jessica Rubeo -- Welcome to the Atlassian Community!

Adding to Trudy's suggestions:

There is a typo in your write to the audit log: it is missing the closing parenthesis for the call to the diff() function.  That is why it shows the "Error rendering smart-values..."

Update: striking through this suggestion.

Kind regards,
Bill

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 30, 2024

Was that Log action there all along? Too much multi-tasking again.

The image I see currently in the original post doesn't have a typo, does it?

Screenshot 2024-07-30 at 2.38.08 PM.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.
July 30, 2024

Oops...my mistake; thanks, Trudy!

We cannot see the write to the log in what was posted.  Seeing what was written with the write to the audit log may explain why the Log Work action is failing.  (Although I suspect removing the math function wrapper will help.)

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 30, 2024

@Jessica Rubeo 

Can you also add Log actions to print out the two custom fields that you are referencing in the smart value you are using in the Log work action?

issue.customfield_10109 and issue.customfield_10110

 

@Bill Sheboy I tried using the math function wrapper myself, but using now() instead of referencing custom fields, and the Automation rule did not object.

Screenshot 2024-07-30 at 3.33.06 PM.png

 

Screenshot 2024-07-30 at 3.33.21 PM.png

Valerie Knapp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 31, 2024

Hi @Trudy Claspill , @Bill Sheboy , I understood part of the point / problem here is trying to obtain the sum / difference between the two custom fields of date time. I am also struggling with this.

I have got to here -

{{#=}}{{issue.customfield_10009.minus(issue.customfield_10008)}}{{/}}m

Where 9 is a change completion date time

and 8 is the change start date time

But I don't get the automation to take the action of logging the work, even though I can get it to calculate the difference between these two fields.

Do you have any advice about how to get this to work please?

Cheers

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.
July 31, 2024

Greetings, everyone!

Let's pause and try some basic diagnostics to help...

@Jessica Rubeo , in your rule please add a write to the audit log with these expressions, and then run it, posting the audit log details from the execution:

customfield_10109 equals: {{issue.customfield_10109}}

customfield_10110 equals: {{issue.customfield_10110}}

diff of values: {{issue.customfield_10109.diff(issue.customfield_10110).minutes}}

This will confirm the fields have non-null values and that Jira correctly interprets them as date / time values.  Otherwise the diff() result will be null.

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

Hi, @Valerie Knapp 

The math functions plus() and minus() should work with date and date / time values, as they are probably implemented as numbers (i.e., milliseconds since 1 January 1970).  However, I have observed inconsistent results in some contexts and so please try using the date and date / time, diff() function with the units of measure needed.

 

Thanks!

Like Valerie Knapp likes this
Jessica Rubeo July 31, 2024

Thanks everyone for your feedback! @Bill Sheboy , I've inputted the Audit Log actions as you've outlined, reflected in the screenshots below:
autoLogWork4.PNG

However it seems as though I'm still getting the "Empty Expression" error:

autoLogWork5.PNG

Is there a specific way I need to nest these actions for it to reflect correctly in the Log work section?

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.
July 31, 2024

Yes, I expected that to still fail...and, you are only showing part of the audit log entry for the rule execution.

Please show the entire log entry's details.  That will show the writes to the log to confirm the smart values which were just added.

Jessica Rubeo August 1, 2024

Apologies for the delay, attached please find the correct readout.autoLogWork6.PNG

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 1, 2024

The last Log action is missing the second curly brace at the end, which is why the last log action shows an error.

Please correct that, run the rule again, and post the new log output.

Screenshot 2024-08-01 at 7.57.02 AM.png

Like # people like this
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.
August 1, 2024

Apologies again...my original post had two typos: curly bracket instead of close parenthesis and missing curly bracket at end.

 

Here is the corrected one:

diff of values: {{issue.customfield_10109.diff(issue.customfield_10110).minutes}}

 

Like Valerie Knapp likes this
Valerie Knapp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 20, 2024

Hey @Jessica Rubeo , did this get resolved for you or do you still need more input?

0 votes
Valerie Knapp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 30, 2024

Hi @Jessica Rubeo , welcome to the Atlassian Community and thanks for your question.

You could try this action instead of the delay -

image.png

which should get the latest status and transition info.

Please give it a go and share your feedback.

Good luck!

Jessica Rubeo July 30, 2024

Hi @Valerie Knapp ! Thank you for your warm welcome and quick reply :)

That definitely feels like a closer step, however I've still gotten the same "empty expression" error:

autoLogWork3.PNG

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