date smart value function ofTheMonth not working inside function

Garrett McCreery
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.
April 1, 2021

Variables

newDate is set to "2021-04-01"

myNumber is set to "4"

myN is set to "1"

myDay is set to "1"

 

Here is what is working "plusDays":

{{#newDate.toDate}}func=plusDays({{myNumber}}){{/}}

returns: "2021-04-05T00:00:00.0+0000"

 

Why can I not do the same with the "ofTheMonth":

{{#newDate.toDate}}func=ofTheMonth({{myN.asNumber}},{{myDay.asNumber}}){{/}}

returns: "2021-04-01T00:00:00.0+0000"

If I log just the inside portion (func=ofTheMonth({{myN.asNumber}},{{myDay.asNumber}})) I get:

func=ofTheMonth(1,1)

 

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

Hi @Garrett McCreery 

My understanding is that created variables do not work as parameters to functions yet: 

https://codebarrel.atlassian.net/browse/AUT-2022

What problem are you trying to solve?  Knowing that may help the community suggest other ways of getting the result with automation.

Best regards,

Bill

Garrett McCreery
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.
August 10, 2021

created variables has nothing to do with my issue. What I am asking is why some functions like "plusDays" works, but "ofTheMonth" does not in my examples above.

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.
August 11, 2021

Garrett, would you please post an image of your complete automation rule?  That may provide context as you note you are not using created variables and yet you seem to be using variables in the function calls.

If posting the image is not possible, I suggest working with your site admin to submit a defect to customer support for their assistance: https://support.atlassian.com/contact/#/

Garrett McCreery
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.
August 11, 2021

I'm not saying that I am not using created variables, I'm saying that they have nothing to do with my issue... 

1. Here is the function "plusDays" being used in a "func" statement and it works fine:

 

Untitled.png

 

 

Here is the function "ofTheMonth" where I am trying to use it in a "func" statement and it is not working. You will see that the function does work, it's just not working with a "func" statement. 

 

 

Untitled 2.png

 

So back to my original question, why do some functions work with the "func" statement, while others do not?

Garrett McCreery
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.
August 11, 2021

Maybe it's only ".OfTheMonth" that is not working with a "func" statement, most of the other date functions work fine.

https://support.atlassian.com/jira-software-cloud/docs/smart-values-date-and-time-functions/

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.
August 11, 2021

Honestly, I have no idea why that function is different.  And I am still surprised you are getting results with created variables as function parameters.

The only open defect I saw for func() and date functions is a problem interpreting string fields as numeric values: https://codebarrel.atlassian.net/browse/AUT-1791

If you have a specific need for a day of week, you might try working around with withNextDayOfWeek() and plus/minus the date.  I have done that to build calendar tables with automation in the Description.

Garrett McCreery
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.
August 11, 2021

I have already created a work around using 5 separate variables. thanks for looking!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer