Question

Time based condition in condition builder

  • 1 June 2023
  • 8 replies
  • 90 views

Userlevel 1
Badge +1

Hi,

So my GoogleFu is failing me on this one so I’m hoping the power of the hive mind can help. :)

So background:  We currently text the whole team when an urgent ticket is raised as if it’s urgent (using Orch and Twilio), then it could be costing the company money.  However recently people have been raising urgent tickets when they are, well, less than urgent.  This means the people working in other timezones are getting texts when they don’t need to.

I was looking at expanding the workflow so that it sends to people in te right timezone in the first instance, then making up a second rule that if the ticket stays unassigned for over 15 minutes, then to text everyone.

I can see that the expression builder has a “now” function, but I can’t get my head around how to make this work (assuming it can be made to work).

My thought is I want to do something like this (I’m psudocoding it here):

If CurrentTime >= 05:00 and CurrentTime <= 17:00 then text person A & B

Then second condition
If CurrentTime >= 17:00 and CurrentTime <= 05:00 then text person C & D

If anyone can point me in the right direction I’d appreciate it.  Whether it’s sending the right expression, or pointing me at a different way to do it (though I think time based automation triggers won’t work as this needs to trigger on new ticket).


8 replies

Userlevel 6
Badge +11

Hi.

I'm order to work with times you need to consider Timezones in time formula for comparison.

But, and based on your example, it seems you're working with shifts, so setting up the proper time zones in the agents should do the trick.

You may also try considering On-Call Management.

 

If any of these is not accurately targeted to your need, would you mind elaborating a little bit more?

 

Hope this actually helps.

 

Regards,

Userlevel 1
Badge +1

It’s sort of shifts.  We all support emergency tickets, but if someone is working in their timezone and someone isn’t, I want to give the person who is in the correct timezone a chance to work on it before it goes out to the wider world.

Never thought of the On-Call management system, it’s not anything I’ve explored yet.  

I’m an old school programmer (or at least used to be) so my brain goes to resolving it programmatically before anything else.  But honestly i don’t mind how it’s done as long as it goes to the working people first.  I’ll take a look and see if it’ll do what I want.  Thanks for pointing me at it.

Userlevel 1
Badge +3

Hi @Jennifer.H 

You could maybe build the workflow based on the time zone of the requester? So if someone raises an urgent ticket then notify certain agents based on their timezone:

 

Then use a timer node to wait 15 mins before notifying other agents in different time zones, just in case it isn’t actually urgent?
 

 

Userlevel 1
Badge +1

Hi @jonathan.allison,

I thought of that but we’re 24\7 with 4 branches, but with only 2 timezones of support right now.   We have an overlap where we’d switch from the US to UK providing support halfway through the day for the JP office.

Long term that’d be perfect, as we’re expanding to have one person in each timezone, but right now it won’t work.


I also looked at the on-call system, and it doesn’t look like it’ll quite do the job either, as it sends to one of the people in the group, not the whole of the secondary, and in the SMS section, you put specific agents.

I half got there programmatically, able to get the hour out of the functions:

substring(now('GMT'),indexOf(now('GMT'),"T",0)+1,indexOf(now('GMT'),"T",0)+3)

But the output is in string format and I can’t see any casting abilities in fresh to convert it to a number for comparison.

If I could make that thing it was a number, I think I could do what i want.  But hey.

Userlevel 1
Badge +1

Actually, for those who are any good at Regex (I just noticed the regexmatch command), is there any way to take that formula I posted and check if it between 5 and 17?

Regex is def one of my weak areas.

Userlevel 1
Badge +1

I just realised that I can just do a bunch of compares,  It’s inelegant, but it should work.  I’ll let you know how it goes.

Userlevel 1
Badge +1

We have a winner!

It’s stupid having to say is it 01 or 02 or 03, etc. but it works.

 

Yoonic GmbH, eine WordPress-Agentur, die 2013 in Wien, Österreich, gegründet wurde, ist seit vielen Jahren in der Welt von WordPress tätig. Von Design über Entwicklung, Hosting bis E-Commerce haben wir jede Facette dieser vielseitigen Plattform erkundet. Mit unserer umfangreichen Erfahrung und einem starken Fokus auf Leistungssteigerung und Serverkonfiguration freuen wir uns, erstklassige WordPress-Webhosting-Dienste anzubieten. Ihr WordPress Homepage-Baukasten hat gerade sein perfektes Zuhause gefunden.

Reply