Forums

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

Try to update 'Start Date' field based on comparison

Alon Shoham
Contributor
February 28, 2023

Hello!

I've created an automation that compares between several date fields (custom fields) and should take the MIN date and insert it to 'Start Date' field.

The automation shows 'Success' but nothing is updating.

Please help :)

image.png image.png image.png image.png

2 answers

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.
February 28, 2023

Hi @Alon Shoham 

I see at least two things to improve your rule...

The MIN function needs to be enclosed in a mathematical expression, and cannot be used stand-alone as you show.  It needs the {{#=}} and {{/}} wrapping.  Please look here for examples of that: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/

Next, created variables are text-type, and so must be converted to a date-type before you may use the format() function.  Please try converting with toDate first, such as with this: 

{{MinStartDate.toDate.format("MM-dd-yyyy")}}

 

Kind regards,
Bill

Alon Shoham
Contributor
March 1, 2023

Thanks for the detailed answer @Bill Sheboy 

I change the Variable and 'edit issue' syntax . Yet the same thing, shows 'success' but nothing is updated in the ticket.

 

image.png image.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.
March 1, 2023

This is interesting (and perhaps a defect): even though the mathematical functions work with numbers and dates, the MIN() function appears to not recognize dates as numbers with this syntax:

{{#=}}MIN({{issue.oneDateField}},{{issue.anotherDateField}}){{/}}

That appears to be true even when the dates are forced into a list for using the list-based min function.

One work-around for your use case appears to be converting to a sortable date format before using MIN(), such as this:

{{#=}}MIN({{issue.oneDateField.format("yyyyMMdd")}},{{issue.anotherDateField.format("yyyyMMdd")}}){{/}}

 

Please try that to set your created variable named MinStartDate.

0 votes
Esther Strom
Community Champion
February 28, 2023

@Alon Shoham can you try logging both the variable ({{MinStartDate}}) and the formatted version you're trying to put into your Start Date field? The date calculation may not be what you expect.

Alon Shoham
Contributor
March 1, 2023

 

@Esther Strom I didn't understand what to do. Could you please elaborate?

Esther Strom
Community Champion
March 2, 2023

@Alon Shoham I was suggesting you use the Log action to print out the value of your smart variable (both the plain variable and the variable with the format function) to the rule's audit log to see what the values actually are.

2023-03-02 12_01_24-Automation - The Jira of Champions - Brave.png

However, @Bill Sheboy has given you much more info already.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events