Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Automation weekdays and weekends

Edited

Hello everyone, I work in a sales company and I need to configure an automation to assign leads to different salespeople (agents) depending on whether it is a weekday or weekend

the first step of automating is when the incident or lead is created, after that I don't know how to continue

1 answer

1 vote
Dirk Ronsmans Community Leader Mar 18, 2021

Hey @david_contreras ,

I assume you mean your trigger is defined then as "issue created"? 

The next step imho would be to add in an IF condition which has a JQL. You could then build a JQL that looks at what day of the week the issue was created.

Jira does not have a weekday or weekendDay function so you have to do some trickery.

I tend to use the startOfWeek() and endOfWeek() functions.

For my "weekdays" If I would add this JQL: 

created >= startOfWeek() and created <= endOfWeek(-2d)

The weekend days would then be 

created >= endOfweek(-2d) and created <= endOfWeek()

This would be my starting point.

Good morning, yesterday I tried it and it worked very well, however today (Friday) the automation assigned issues to the agents designated for the weekend :(

Dirk Ronsmans Community Leader Mar 19, 2021

Hey @david_contreras ,

I think that might be with the 2nd JQL

Can you change that to

created > endOfWeek(-1d) and created <= endOfWeek()

That would make more sense as endofWeek() = Sunday and then -1d would be Saturday.

By doing -2d we include Friday (which is fine for the first JQL i guess..

It did not work for me, I investigated and
startOf Week () starts Sunday 00:00 h
endOfweek () is Saturday just before Midnight

That is why it did not work before, I tried with this function, it assigns me the weekdays well, however the weekend function does not assign Saturday but Sunday yes, help please

For weekdays
created >= startOfWeek(1d) and created <= endOfWeek(-1d)
The weekend days
created > startofweek(-1d) and created <= startOfWeek(1d)

@david_contreras 

Hi David,

Did you ever figure this out? My business days start on Sunday as well.

Thanks

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
Community showcase
Published in Jira Service Management

Next level incident management in Jira Service Management

Hello Atlassian Community! We’re thrilled to announce some exciting changes to incident management in Jira Service Management Cloud, in order to give your teams extra muscle during incidents, and ...

1,463 views 20 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you