I am trying to create an automation that will clone an issue and update the due date to a specific date depending on input from two custom fields.
For example, the user may choose to clone the task monthly on the 3rd of the month.
They may also choose to clone the task annually on the 15th of the month.
I have one custom field for choosing the frequency of the clone.
I have a second custom field for choosing which day of the month the task should be due.
Both custom fields are single choice select lists.
If I use the smart value {{issue.Due Day.value}}, I get the chosen result which is an integer between 1 and 30.
How do I use that value to drive another smart value?
For example if I type {{issue.created.withDayOfMonth(1)}} into the value for Due date, it will change to the first of the current month.
But {{issue.created.withDayOfMonth(Due Day)}} does nothing.
I've tried formatting it a few ways, but think I must be going down the wrong path.
Perhaps I can append values in the Additional fields section?
Hi @Brock Jolet -- Welcome to the Atlassian Community!
First thing: there is a built-in field called Due Date, so I recommend using another name. The built-in field is what drives time ranges for things like roadmaps.
Next, in your calculation ensure you fully specify the field smart value, such as:
{{issue.created.withDayofMonth(issue.myDueDateCustomFieldName)}}
One thing to help as you work through this is to use the log action to write pieces of the value to the audit log...and as you add pieces you can more easily see the impact.
If this still isn't working, please consider posting an image of your entire rule and an entry from the audit log showing an execution. That will provide context for the community to offer ideas.
Best regards,
Bill
Hello @Bill Sheboy , thanks for the reply.
Here is a collection of screenshots to demonstrate what I am seeing.
First I convert the custom field value to a temporary value that displays correctly in the audit log as "1".
Due Day: 1
The issue had a starting value in the Due Date field of 2021-06-01.
When this rule runs, the value should not change since the card was created in June and the Due Day is 1.
However, it appears the smart value {{issue.created.withDayOfMonth(issue.dayChosen)}} is not valid, so the Due Date field simply becomes empty.
In the second audit log I also included the results of manually assigning the value of 1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, now I see...Created Variables cannot be used a parameters in smart value functions (yet...)
Have you tried to directly use that field value in the expression:
{{issue.created.withDayOfMonth(issue.Due Day.value)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy Yep. I get the same result. There is no error, but the field is left empty.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you write that to the audit log rather than try to change the field, does it work?
If not, please try without the .value expression:
{{issue.created.withDayOfMonth(issue.Due Day)}}
And, would you please confirm if the Due Day custom field type is Numeric in the setup? Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy Even when written to the audit log I get an empty value whether I use .value or not.
Due Day is a Select List (single choice) with a series of numeric choices.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that info, and... Your field looks like a number, but it is not one because it is in the list field. Let's try to convert it into a number before doing math on it:
{{issue.created.withDayOfMonth(issue.Due Day.asNumber)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy Thanks! That got me to where I needed to be.
Just using .asNumber wasn't enough, but using .value.asNumber worked.
{{issue.created.withDayOfMonth(issue.Due Day.value.asNumber)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.