Missed Team ’24? Catch up on announcements here.

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

Custom smart variable not working when used as function parameter

nik_shivamprajapati March 1, 2022

https://jira.atlassian.com/browse/JRACLOUD-75659

As per the above link, the issue is resolved but I'm still not able to use the custom smart variable as a function parameter.

e.g.

1. Create a custom variable in automation

lastcreated = {{attachment.created.max}}

2. logging {{now.diff(lastcreated)}} prints nothing.

How to resolve the issue?

2 answers

1 vote
Yvan Martin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 21, 2022

Hi @nik_shivamprajapati ,

Developer from Automation here.

There is now the ability to use saved variables in smart value function calls, but currently the saved variables are stored as text instead of their original object/type so in this case your lastcreated is returning text instead of a date that would allow date functions.

To get this working you'll need to call toDate on that field when using it in your function e.g. {{now.diff(lastCreated.toDate).millis}}. 

If you are still having issues feel free to leave a comment on that public issue: https://jira.atlassian.com/browse/JRACLOUD-75659 . Otherwise get in contact with support here: https://support.atlassian.com/

Cheers.

0 votes
Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 1, 2022

@nik_shivamprajapati ,

Just guessing here but shouldn't you encapsulate the smart value?

 {{now.diff({{lastcreated}})}} 

You can also start by just first logging 

{{lastcreated}} on it's own to see if that returns anything

image.png

nik_shivamprajapati March 1, 2022

@Dirk Ronsmans 

It is throwing an error

Above log is {{lastcreated}} and below one is {{now.diff({{lastcreated}})}}.

 

Screenshot 2022-03-02 at 10.22.29 AM.png

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events