Dynamic <X half of month> in automation

Ali Ahmed Dar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 12, 2025

Hi people,

i am making an automation which is scheduled and runs to edit the summary of a ticket like: First half of March or Second half of February or whatever - depending on the current date/number of day of month,

Here is what chat gpt gave me:

 

{{#if(now.dayOfMonth <= 15)}}First Half of {{now.monthAsText}}{{else}}Second Half of {{now.monthAsText}}{{/}}

 

but it does not seem to be working

2 answers

0 votes
Vishal Biyani
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 12, 2025

@Ali Ahmed Dar 

Your problem statement is not clear.

if you want to have a logic for 1st half of the month or 2nd half, this is how if works

{{if(now.format("d").asNumber.lt(15), "First half", "Second half")}}

Ali Ahmed Dar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 12, 2025

Hi @Vishal Biyani you understood it right, but it seems like it always prints Second half - as in whatever the second value is

 

Also when i write {{if(now.format("d").asNumber)}} it prints nothing

 

 

Vishal Biyani
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 12, 2025

Can you confirm you are using cloud?

In datacenter all automation rules may not work like cloud. 

When I tried with 

{{if(now.format("d").asNumber.lt(10), "First half", "Second half")}}

I am getting Second half.

if I try with

{{if(now.format("d").asNumber.lt(15), "First half", "Second half")}}

I am getting first half

 

To print the value you need to do

 {{now.format("d").asNumber}} 

 

Vishal Biyani
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 12, 2025

in JIRA DC, as per documentation i didn't see asNumber.

if below gives empty result, then try without asNumber and see if it works

{{now.format("d").asNumber}} 

 

0 votes
Marc - Devoteam
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 12, 2025

Hi @Ali Ahmed Dar 

Welcome to the community.

{{#if is a Cloud smart value function, not DC and is for calculation

AI is not a way to go on Jira automation, AI mixes al kind of information on JIra and self bult smart values.

See all on data smart values here; https://confluence.atlassian.com/automation/jira-smart-values-date-and-time-993924864.html 

I'm not in to DC so heavily, but check out the smart values via the link in DC automation, AI won't provide the answer.

monthAsText, is not even an option.

To display the name of a month in the future or past, this is the syntax:

  • Future: {{now.minusMonths(1).format("MMMM")}} -> result April
  • Past: {{now.plusMonths(1).format("MMMM")}} -> result February

Suggest an answer

Log in or Sign up to answer