Skip to main content
Solved

Help with creatich expression


Forum|alt.badge.img+1
  • Contributor
  • 3 replies

I want to make a workflow for mails recieved between Saturday 20:00 to Monday 05:00.

For the saturday i try this: 

if(weekday({{ticket.created_at}}) == 7 and substring({{ticket.created_at}},11,13) > 20) 

But i keep getting "invalid operator” errors. als i cant seem to find a list of what format the value of the placeholders (like {{ticket.created_at}}) are.

Can someone help me on how i can do this? 

 

Best answer by DirkH

Thanks for the quick answer. apparently the weekday's where still of (Saturday is 0 and not 7 as the explanation in the expression builders says) but I managed to do what I wanted with this: 

(((weekday('{{ticket.created_at_iso}}') == 0 && substring('{{ticket.created_at_iso}}',11,13) > '19'))|| (weekday('{{ticket.created_at_iso}}') == 1)|| ((weekday('{{ticket.created_at_iso}}') == 2 && substring('{{ticket.created_at_iso}}',11,13) < '05')))

 

View original
Did this topic help you find an answer to your question?

3 replies

Daniel Söderlund
Skilled Expert
Forum|alt.badge.img+14

Hello, 

You can look here for how placeholders will look like https://api.freshservice.com/v2/#create_ticket

But you need to use this {{ticket.created_at_iso}} to get the correct format. 

You need to do something like this. you was missing som ‘ 
This is set to Boolean as output. 

if(weekday('{{ticket.created_at_iso}}') == 7 && substring('{{ticket.created_at_iso}}',11,13) > '20',true,false)



weekday('{{ticket.created_at_iso}}') == 7 && substring('{{ticket.created_at_iso}}',11,13) > '20'

Both of them works, 

 


Forum|alt.badge.img+1
  • Author
  • Contributor
  • 3 replies
  • Answer
  • August 14, 2023

Thanks for the quick answer. apparently the weekday's where still of (Saturday is 0 and not 7 as the explanation in the expression builders says) but I managed to do what I wanted with this: 

(((weekday('{{ticket.created_at_iso}}') == 0 && substring('{{ticket.created_at_iso}}',11,13) > '19'))|| (weekday('{{ticket.created_at_iso}}') == 1)|| ((weekday('{{ticket.created_at_iso}}') == 2 && substring('{{ticket.created_at_iso}}',11,13) < '05')))

 


Daniel Söderlund
Skilled Expert
Forum|alt.badge.img+14
DirkH wrote:

Thanks for the quick answer. apparently the weekday's where still of (Saturday is 0 and not 7 as the explanation in the expression builders says) but I managed to do what I wanted with this: 

(((weekday('{{ticket.created_at_iso}}') == 0 && substring('{{ticket.created_at_iso}}',11,13) > '19'))|| (weekday('{{ticket.created_at_iso}}') == 1)|| ((weekday('{{ticket.created_at_iso}}') == 2 && substring('{{ticket.created_at_iso}}',11,13) < '05')))

 

Nice, ya sometimes we need to do some trial and error. Don’t forget to mark this as solved. 


Reply