Missed Team ’24? Catch up on announcements here.

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

Smart Value Computations

Ray Balmeo Cagayon May 7, 2024

Updated Problem Statement:

Need help on the syntax for the computing date difference between current time (now) and a pre-set datetime (Need By Date).

Variable: Need By Date (DateTime)

Simplified Trigger. Trigger is working and runs a query every five minutes. Objective is to compute the test hours remaining in every issue.

image.png

 

1. {{now.diff("Need By Date").hours}} 

    No Errors on the automation but returns a null result.

 

image.png 

 

2. {{(now).diff("Need By Date").hours}}

    Error on execution.

image.png

3. {{"Need By Date".diff(now).hours}}

    Working but negative results. 

image.png

4. {{"Need By Date".diff(now).hours.multiply(-1)}}

     Works perfectly fine.

 

I need to put an extra process on my computation just to get the desired result.

My question is what would be the correct syntax if i reverse my variables (1 and 2)  instead of the (3,4) approach.

 

 

1 answer

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.
May 7, 2024

Hi @Ray Balmeo Cagayon 

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected.  Those will provide context for the community to offer ideas.  Thanks!

Until we see those...

For your second case, you have parentheses around the now smart value.  Please try to remove those and re-test.

Kind regards,
Bill

Ray Balmeo Cagayon May 7, 2024

@Bill Sheboy , updated the problem statement. Thanks for the help.

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.
May 8, 2024

Thanks for that information, Ray.

There are known problems having now first in a diff() expression, although there does not seem to be consistency of the symptoms (according to community posts).  Additionally, there is a known problem where it diff() does not work accurately inside of an iterator / loop.

 

You note "Need By Date" is a variable date / time.  Do you mean it is a created variable in the rule or that it is a custom field of type date / time?

Ray Balmeo Cagayon May 8, 2024

@Bill Sheboy ,

That's a custom field of type date / time?

Option 4 is working for me. I just don't understand that why i can't do that in reverse.

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.
May 8, 2024

What type of project is this: company-managed or team-managed?  You may find that information at the lower-left of the page expanding area.

And if this is team-managed, did you add this custom field yourself to the project?

Suggest an answer

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

Atlassian Community Events