Smart value variable doesn't include the actual value

Susan Merola December 13, 2024

Hi everyone. I'm trying to create a smart value variable to use as part of an automation and I'm not sure why it's not working.

I want to add a label that shows the due date year when a particular kind of issue type is created. So for example if the due date is June 4, 2026, then a label that says "2026" would get added by the automation. 

This is what I've set up:
Screenshot 2024-12-13 112357 1.png

And then:
Screenshot 2024-12-13 112442 2.png

But this what gets populated:
Screenshot 2024-12-13 112548 3.png
Can anyone tell me where I'm going wrong? 

Thanks in advance for your help!


1 answer

1 accepted

0 votes
Answer accepted
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.
December 13, 2024

Hi @Susan Merola 

The Due Date field is a "date type" and Labels are text.  The date value must be formatted to be used as a label, as described here: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-format---

For example, you could use this to get just the year value as text:

{{issue.duedate.format("yyyy")}}

 

Kind regards,
Bill

Susan Merola December 18, 2024

Hi Bill. Thanks for your reply.

Yes, I hadn't thought about that but it makes perfect sense. I've just tested out the string you shared and I got this:

 Screenshot 2024-12-18 162039.pngScreenshot 2024-12-18 162039.png

So maybe there's some other step that I'm missing?  This is what my whole automation looks like:

Screenshot 2024-12-18 162309.png

 

Any guidance would be most welcome. Thanks!

 

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.
December 18, 2024

Would you please post images of your Edit Issue Fields action and of the audit log details showing the rule execution?  Thanks!

Susan Merola December 18, 2024

Sure, thanks for the quick reply! Here's the Edit Issue action:

edit.png

 

And here's the log entry:

log.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.
December 19, 2024

I wonder if the Due Date field is empty...I see your rule is using the Issue Created trigger.  That one can fire so quickly that some issue data may not yet be available to the rule.

The fix for that is to always add the Re-fetch Issue action immediately after the Issue Created trigger.  This will slow down the rule a bit, reloading the data before proceeding. 

Please add that action and try re-testing.

Susan Merola December 19, 2024

Hi Bill.  

Just wanted to let you know that I've just discovered that my problem was in the Edit Field. Putting the actual smart value there, instead of the variable name, solved the problem. Screenshot 2024-12-19 133058.png

Thanks for the suggestion about Re-Fetch action though. I didn't know about this action and have several automations where I've included delays but this will be a much better solution. 

Thanks again for all of your help! Happy holidays!

 

Like Bill Sheboy likes 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.
December 19, 2024

That is curious, as I am confident if that full expression may be used to add a label the variable's smart value could as well.

I still recommend removing the Delay() action and adding Re-fetch Issue after the trigger and testing again.  This symptom seems like a timing problem.

Susan Merola December 19, 2024

Yes, removing the delay also works! 

This is the updated rule:

rule.png

And this is from my issue!
due.png

Thanks Bill, that's a good learning to consider all of the different timing elements when building a rule. I'll keep that in mind as I'm building new rules.

Like Bill Sheboy likes 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.
December 19, 2024

Awesome; I am glad to learn it is working!  Please consider marking this question as "answered" to help others with a similar need find solutions faster.  Thanks!

Susan Merola December 19, 2024

Done! Thanks again for your help!

Suggest an answer

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

Atlassian Community Events