Hi, I am trying to build Leave Management using Jira service management. I want to calculate weekend days and holidays on the Jira Service Management portal by using a script. for that purpose, I am using the cloud.
Hi @Ravina !
I agree with @Pramodh M , it sounds nice.
But what is your question? Have you already done somethig? Do you have any difficulties?
I want to create leave management.
by using Jira service management raise requests through the customer portal.
on that form, I used 2 fields start date and end date so I want to calculate only working days.
for e.g I will be raising a request for leave which is 17-02-2022 to 22-02-2022 .so it will count as only 3 days' leave .it will not count Saturday, Sunday, and bank holidays also. by using the cloud, not using confluence and plugin also.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ravina !
Got your case, thanks!
I'm not sure, but I think it is possible using out-of-box Automation.
You need 3 fields:
- start vacation date (customfield_20001)
- end vacation date (customfield_20002)
- vacation duration (business days)
Then create a rule with trigger "Issue created", then action "Edit issue field", select "vacation duration" and add something like this:
// The number of business days beeween when the issue was created and today
{{issue.customfield_20002.diff(issue.customfield_20001).businessDays}}
I got it from the official documentation - Examples of using smart values with dates
Best regards,
Alexander
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, @Alexander BondarevThanks It's working.
but it was showing the wrong answer. for e.g start date -(17-07-2022) and end date -(25-02-2022)
showing answer is =6
but the expected answer is = 7.
I used this code
{{issue.customfield_10108.diff(issue.customfield_10109).businessDays}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad to hear that! Cool, that it works.
Hm. for my Country it will be correct, we have a holiday at 23/02. =) But I got your question and logic.
I need to think a bit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is really strange, because you can configure the similar setting in 3 places:
- Configure working days on boards (different types)
- Create and edit SLA calendars
1st, I think, that you have out-of-box configurations.
2nd, 3rd - it doesn't matter in our current case.
Try to check another dates... for example, 04/04/22 and 24/02/22.
And if it will be the same result, I can recommend you to raise a support request on that.
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.
Hi @Ravina
It works best if you have Confluence with Team Calendars (Confluence Premium)
Please find the reference here
https://www.atlassian.com/blog/inside-atlassian/managing-vacation-days-jira-confluence
Thanks,
Pramodh
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.