I am trying to use smart values to set the date of a custom date picker field to the previous business day based on the issue's due date.
Using this info I have: {{issue.duedate.toBusinessDayBackwards()}}
This sets the field to the same date as the due date.
I've also tested out {{issue.duedate.toBusinessDayBackwards(1)}}
This just blanks out the field.
In the documentation I see that business days are presumed to be M-F 9-6, but do I need to set business days on the project level somewhere?
Hi @Dan Finn -- Welcome to the Atlassian Community!
I believe this one is a case-sensitivity issue: dueDate rather than duedate.
And, the "business days" appear to be fixed, as you noted. The only way I have been able to work around this was quite elaborate:
Yup, that is messy :^)
Best regards,
Bill
Hi @Bill Sheboy,
Thanks! Glad to be here & thanks for the thoughtful response as well.
Unfortunately Im still getting the same behavior with {{issue.dueDate.toBusinessDayBackwards()}} and ...(1)}} but maybe testing on a different set of fields will reveal something.
Fortunately, we dont have a need to alter our business days, but I imagine that your summary is going to be a huge help for someone out there.
Regards,
Dan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dan,
The Due Date field seems curious, and I got it to work using JSON field editing. Note this smart value does not match the documentation or what you get back if you query with the REST API.
You can access the value in Due Date for reading with:
{{issue.Due Date}}
To write in the field with Edit Issue, I had to use additional fields with JSON, and the minusBusinessDays function:
{
"fields": {
"myCustomDate": "{{issue.Due Date.minusBusinessDays(1)}}"
}
}
Here is the documentation sources I referenced:
https://support.atlassian.com/jira-software-cloud/docs/advanced-field-editing-json/
https://support.atlassian.com/jira-software-cloud/docs/smart-values-date-and-time-functions/
Best regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.