Jira Automation - Date manipulation troubles in smart values

TP
Contributor
December 12, 2023

I am trying to create a date smart value to be used for start date and due date for subsequent issues created in the same automation.

Screenshot 2023-12-13 at 10.00.17 AM.png

 

The create smart variable step is

Screenshot 2023-12-13 at 10.02.04 AM.png

 

I run this rule with manual input `2023-12-20`

And I get this log

Screenshot 2023-12-13 at 10.03.06 AM.png

 

Why can I not format my date even though it looks like it is correctly cast as a date when I create it ?

1 answer

1 accepted

1 vote
Answer accepted
Sayed Bares [ServiceRocket]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 12, 2023

@TP that happens because when you create a variable, it will always return a string.

Create variable

  • Use smart values here: Yes

Define your own smart value, which can be used in other actions and conditions in the same rule. The smart value you define can consist of other smart values, as well as math functions.

Note that this will always return a string. For example, if you created variable called Stakeholders with the smart value {{issue.watchers.distinct}}, your variable would return the list of watchers but the list would be rendered as a string.

So in your last log action, you will need to convert the variable back to a date first and then you can format it in whichever way you want:

  • {{startDate.toDate.mediumDate}}
TP
Contributor
December 12, 2023

Thank you ! I indeed figured it out but it is not spelled out anywhere and it's not intuitive at all. If someone from Atlassian is watching this, please add it to the help text.

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, 2023

Hi @TP 

The documentation for the Create Variable action describes it is always a string (i.e., text data type).  You may find that information here: https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Create-variable  And that documentation is noted in the rule builder when using the action.

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events