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

Date and time functions

Kamil Blicharski May 28, 2021

Is it possible to use a variable or a custom field when formatting the date, e.g. 

{{now().plusHours({{"customfield_10286"}})

2 answers

0 votes
Kamil Blicharski May 31, 2021

Instead of a constant value in the plusHours () function I need to be able to use a variable from a field such as a numeric or a drop-down list, that's all.
If possible, please give me an example and syntax.
While browsing this thread, I have doubts if it is possible here 

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 28, 2021

Calling the expert - @Bill Sheboy 

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 28, 2021

Hi @Kamil Blicharski and @John Funk 

I note you are trying to nest the smart values and wrap a number with quotation marks, which could be part of the issue.  Depending upon your custom field type, maybe try this:

{{now().plusHours(issue.customfield_10286.asNumber())}}

If that does not help, what problem are you trying to solve?  Knowing that may reveal alternative solutions.

Best regards,

Bill

Like John Funk likes this
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 31, 2021

Hi Kamil - please make your responses in the same thread here so that future readers can follow the conversation.

Did you try the syntax provided by Bill above? 

Kamil Blicharski May 31, 2021

Instead of a constant value in the plusHours () function I need to be able to use a variable from a field such as a numeric or a drop-down list, that's all.
If possible, please give me an example and syntax.
While browsing this thread, I have doubts if it is possible here 

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.
June 1, 2021

Hi @Kamil Blicharski 

With automation rules, it is not yet possible to use a created variable as a parameter to a function.  If you just need to use a field from the issue, that does work.  Please see the example I provided.

Like # people like this
Yannick Roethof March 8, 2022

Would it be possible to use the syntax the other way around? So instead of using now to solve a math expression, I would would want to use a custom field as input.

 

Example: {{issue.customfield_100xx.minusBusinessDays(3)}}

 

In which my custom field would represent a delivery date (arrival at customer) and the output would be my due date (departure for transport).

John Funk
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 8, 2022

@Yannick Roethof  - Welcome to the Atlassian Community!

Sure, you can do that. 

Like Yannick Roethof likes this

Suggest an answer

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

Atlassian Community Events