Question

Set Status as Open on Specific Date/Time

  • 8 September 2022
  • 18 replies
  • 266 views

Userlevel 7
Badge +13

Hello, 

I have requests from customers to be able change status at a given time. 
They want to add a date field to the forms and when an agenten sets specific date and time the ticket should set on pending and be reopened on that date and time.  If the time node would have had input field where we could use a placeholder from the form and not just hard set. 

 


Seen post about this but couldn’t find them. 


18 replies

Userlevel 7
Badge +13

@joonasv have you looked at {{current_date_and_time_iso}} ?

Userlevel 7
Badge +13

@joonasv  oh okay, just checked on day’s. 

Badge

@joonasv Why don’t you just do it this way 

 

If you like to use a expression 

diffInDays(today('Europe/Stockholm'),'{{ticket.ri_241_cf_start_date_iso}}')==10

You need to use the _iso version of the placeholder. 

You can do hours as well just use diffInHours but that you need to setup clone of the same WFA for every hour. 

 

 

 

Thank you for the suggestion!

 

This is what I originally tried:

diffInDays({{ticket.scheduled_time_iso}},today('Europe/Helsinki'))

The issue with this was that this checks days, not hours or minutes, rendering the time field obsolete.

 

We cannot use “today”, as it only returns the day, and hours will be set as 00:00 each time, skewing the original requirement.

 

This does not work, it gives out a syntax error:

diffInHours({{ticket.scheduled_time_iso}},now('Europe/Helsinki'))

 

This is due to the syntax of “now”:

now('Asia/Kolkata')
Result: 2019-08-06T00:45:34+05:30


And this cannot be compared with {{ticket.scheduled_time_iso}} normally using diffInHours, because the diffInHours syntax is as such:

 

Syntax

diffInHours(start_date, end_date)

date - ( yyyy-mm-dd )

date-time - ( ( yyyy-mm-ddThh:mm:ssZ )

Only ISO formatted date/date-time placeholders are accepted.

ExamplediffInHours('1993-07-13T11:45:34Z','1993-07-15')

 

 

Userlevel 7
Badge +13

@joonasv Why don’t you just do it this way 

 

If you like to use a expression 

diffInDays(today('Europe/Stockholm'),'{{ticket.ri_241_cf_start_date_iso}}')==10

You need to use the _iso version of the placeholder. 

You can do hours as well just use diffInHours but that you need to setup clone of the same WFA for every hour. 

 

 

Badge

Hello,

 

Sadly, to achieve this, it is not as easy as this:

This is due to Freshservice turning the dates weird for these custom date fields, and they cannot be used in Conditional nodes by default. It seems as if only the day will be used, not the time.

 

However, I may have a solution for you for this, but it might not be the most beautiful or simplest solution, but it was the solution that fixed a similar issue for us, and it depends heavily on the Expression nodes on the Workflow Automator.

 

 

It runs daily at certain intervals (why we can’t time these based on every 15/30/60 minutes is beyond me). First we check if the ticket is actually scheduled (we use a status and a “Scheduled time” date and time field {{ticket.scheduled_time}} to check this):

 

 

Then we parse the DAY the {{ticket.scheduled_time}} has:

trim(substring("{{ticket.scheduled_time}}", 4, 7))

 

After this we get the MONTH:

if(substring("{{ticket.scheduled_time}}", 11, 12) == ",", ((indexOf('JanFebMarAprMayJunJulAugSepOctNovDec', trim(substring("{{ticket.scheduled_time}}", 8, 11)), 3) + 1) / 3) + 1, ((indexOf('JanFebMarAprMayJunJulAugSepOctNovDec', trim(substring("{{ticket.scheduled_time}}", 7, 10)), 3) + 1) / 3) + 1)

 

And the YEAR...:

if(substring("{{ticket.scheduled_time}}", 11, 12) == ",", substring("{{ticket.scheduled_time}}", 13, 17), substring("{{ticket.scheduled_time}}", 12, 16))

 

Then the HOUR...:

trim(substring("{{ticket.scheduled_time}}", indexOf("{{ticket.scheduled_time}}", ":",0) - 2, indexOf("{{ticket.scheduled_time}}", ":",0)))

 

Then we set the HOUR to the correct format...:

if(length('{{E4.result}}') == 1, concat('0','{{E4.result}}'), '{{E4.result}}')

 

The MINUTES:

substring("{{ticket.scheduled_time}}", indexOf("{{ticket.scheduled_time}}", ":",0) + 1, indexOf("{{ticket.scheduled_time}}", ":",0) + 3)

 

Then using these new Expression values, we construct the {{ticket.scheduled_time}} in dateTime format:

dateTime({{E3.result}},{{E2.result}},{{E1.result}},{{E5.result}},{{E7.result}},00,'Europe/Helsinki')

 

And finally, we check if the newly constructed dateTime is before or after the current time the automator is being run at (this could have been a Conditional node with the expression, but hadn’t realised this is a thing already, you could probably build all of these expressions in to one single expression and use that):

if('{{E8.result}}' < now('Europe/Helsinki'), 'true', 'false')

 

After that we check if this new value is true or not:

Then we simply set the status of the ticket to Open, and add a Note:

 

You could probably add a Slack or whatever orchestration here to send the agent a message that the scheduled time has passed. We’ve solved this by sending the agents a message one day before the scheduled time.

 

Not sure if this helps, hopefully I understood the question!

Userlevel 3
Badge +2

In Freshservice it’s much easier now. 

 

You have a custom date field, a scheduled automation that runs every day. If fields date match to days date or x days before the ticket is reopen. 

When the scheduled workflows first came out, I tried to convert my process to it, but it was lacking something. I will need to revisit this as this would be the simpler solution. Thank.

Userlevel 7
Badge +13

In Freshservice it’s much easier now. 

 

You have a custom date field, a scheduled automation that runs every day. If fields date match to days date or x days before the ticket is reopen. 

Userlevel 3
Badge +2

I have had the same issue with Employee Separations.  The ticket of the separation is created, but the employee separates on a future date. 

My not so elegant solution is to Set the ticket to pending (via workflow) and have the same workflow create a Windows Scheduled task on a local (cloud) server that will run a powershell script on the scheduled date.

That PS script will run the api call and set the ticket to open. I have a second workflow that will kick off when the ticket goes from pending to open and the service item is Employee Separation. That workflow completes all the needed automations and routes the ticket appropriately and creates all the needed tasks.

To implement this feature, you would need to incorporate both a date/time field and a status field into your ticketing system. Here's a general outline of how you could implement this functionality:

  1. Update Ticket Form: Add a date/time field to the ticket creation or update form, where agents can specify the desired date and time for the status change.

  2. Backend Logic:

    • When a ticket is submitted or updated with a date/time specified for the status change, store this information along with the ticket details.
    • If the specified date and time are in the future, set the ticket status to "Pending" or any relevant status.
    • Implement a mechanism to trigger the status change at the specified date and time. This could be done using a scheduler or a background task that periodically checks for tickets whose status change time has been reached.
  3. Notification System:

    • Notify the relevant agents when a ticket's status changes.
    • Notify the requester when the ticket is reopened or transitions to another status.
  4. User Interface:

    • Provide a way for agents to view and manage tickets with pending status changes. like chickfila
    • Allow agents to manually intervene if needed, such as changing the status before the scheduled time.
  5. Input Field Enhancement (Optional):

    • If your current system doesn't support placeholders or dynamic input fields for time nodes, you may need to enhance it to allow such functionality. This could involve customization or integration with a form builder that supports dynamic input fields based on form data.
Userlevel 7
Badge +16

Wow @Casey B thats fancy! Insightful way of getting some time related actions to take effect :)

Userlevel 7
Badge +13

As a workaround, I did the following test in my own instance, but there needs to be additional thought about how to limit when other updates are made to a ticket since these are triggered from a simple condition.

Employee Out of Office using supervisor rule, fields, and automator

  1. Created new statusRequester OOO
  2. Created a new date fieldReturn from out of office
  3. Created a new checkbox field “Returned from out of office
  4. Created a business rule if status is “Requester OOO” show “Return from out of office
  5. Created a business rule to always hide “Returned from out of office
  6. Created a supervisor rule if status is “Requester OOO” and hours since “Return from out of office” is greater than 0, set “Returned from out of office” to Selected
  7. Create/modify workflow - ticket is updated → Condition is “Returned from out of office” is selected → actions… 

Another customer had similar success using the Expression of now( ) (E1 - Expression #1) and then taking that result (E1), and if E1 is greater than “Return from out of office”, condition is “true” kick actions off after. 

Example workflow using expression

Using the new hire start date, you could also reference that date/time field for when to start a set of actions. 

Does this help as a workaround for now?

Hello @Casey B  

Hmm, I tried to create the supervisor rule but couldn’t find the date field in the dropdown list. 
Other than that, it looks promising. 

I guess you could use due date, set the due date using a WFA and API and then supervisor to reopen the ticket when due date is 0. Not tested it. But Chaning the due date could mess up the SLA if you are picky about that.  
 

Userlevel 3
Badge +2

As a workaround, I did the following test in my own instance, but there needs to be additional thought about how to limit when other updates are made to a ticket since these are triggered from a simple condition.

Employee Out of Office using supervisor rule, fields, and automator

  1. Created new statusRequester OOO
  2. Created a new date fieldReturn from out of office
  3. Created a new checkbox field “Returned from out of office
  4. Created a business rule if status is “Requester OOO” show “Return from out of office
  5. Created a business rule to always hide “Returned from out of office
  6. Created a supervisor rule if status is “Requester OOO” and hours since “Return from out of office” is greater than 0, set “Returned from out of office” to Selected
  7. Create/modify workflow - ticket is updated → Condition is “Returned from out of office” is selected → actions… 

Another customer had similar success using the Expression of now( ) (E1 - Expression #1) and then taking that result (E1), and if E1 is greater than “Return from out of office”, condition is “true” kick actions off after. 

Example workflow using expression

Using the new hire start date, you could also reference that date/time field for when to start a set of actions. 

Does this help as a workaround for now?

Userlevel 7
Badge +13

@daniel.soderlund I have to agree with you that it would be nice to be able to set the timer node with a date/time instead of just a hard “elapsed” time delay. We can’t even use the expression builder to do the calculations to get a number of seconds, hours, days, etc and plug that result into the timer delay. I feel as if this node was misrepresented when it was advertised. It was my understanding we would be be able to set a date/time for the continuation of the workflow. But I most likely just misunderstood.

Tagging a few people to help get this feature enhanced, we really need the ability to trigger workflow on a specific date and time!! @sanofar.allahpichai @Casey B. Fingers crossed we can get this feature soon 🤞

My apologies if I had misled you Zachary. In my mind, the timer node was an analogous to a kitchen timer. I spent many years in restaurants before working in technology the timer was always a countdown to another step - pull the potatoes, change sanitation buckets, add the cream, or remove something from the oven, for example. To me, I often look at workflow automator as a recipe and the timer was there to ensure nothing got burnt or was started too early with the idea that everything comes out at the right time. 

Can you help me understand your use case for a date node in a workflow automation? This would only work one time, but maybe I am missing something. I can see day of the week, every other Wednesday, etc. but not Dec 10th, 2022. Time does make sense as well - say you want to occur at the start of business hours or 8PM. Is this what you mean by time?

That you can use a placeholder from a date field in the ticket in the Timenode. 
This would set the ticket in pending until that date/time. 

Use case would be that you plan to call the customer next week to confirm it worked or the customer are out of office and back that day. 

Another use case would be; A manager requests a new user that going to start in 3 weeks. You don’t want to create the user right away due to license costs.  You take the placeholder from the request date/time field and paus the WFA that creates the user using a time node. Each item in the kit/bundle has different solution time. Order a computer need to be done direct or x time befor the new user starts to work. 

 


 

Userlevel 7
Badge +16

@daniel.soderlund I have to agree with you that it would be nice to be able to set the timer node with a date/time instead of just a hard “elapsed” time delay. We can’t even use the expression builder to do the calculations to get a number of seconds, hours, days, etc and plug that result into the timer delay. I feel as if this node was misrepresented when it was advertised. It was my understanding we would be be able to set a date/time for the continuation of the workflow. But I most likely just misunderstood.

Tagging a few people to help get this feature enhanced, we really need the ability to trigger workflow on a specific date and time!! @sanofar.allahpichai @Casey B. Fingers crossed we can get this feature soon 🤞

My apologies if I had misled you Zachary. In my mind, the timer node was an analogous to a kitchen timer. I spent many years in restaurants before working in technology the timer was always a countdown to another step - pull the potatoes, change sanitation buckets, add the cream, or remove something from the oven, for example. To me, I often look at workflow automator as a recipe and the timer was there to ensure nothing got burnt or was started too early with the idea that everything comes out at the right time. 

Can you help me understand your use case for a date node in a workflow automation? This would only work one time, but maybe I am missing something. I can see day of the week, every other Wednesday, etc. but not Dec 10th, 2022. Time does make sense as well - say you want to occur at the start of business hours or 8PM. Is this what you mean by time?

Hey Casey, you didn’t mislead me. I think what would work best is if we could set the timer dynamically via a placeholder. So yes the workflow may only execute once but it would get triggered by the creation of, let’s say, a service request and then allow us to populate the timer delay to delay the workflow until that dynamically placed date and time. Then the workflow would continue. Or...if the field that holds the timer numerical value (“how many” seconds, days, etc) could take placeholders, so that we could use the expression builder to gain a “result” to plug into the field in the delay timer. Hope that helps explain its use. Thanks again!

Userlevel 3
Badge +2

@daniel.soderlund I have to agree with you that it would be nice to be able to set the timer node with a date/time instead of just a hard “elapsed” time delay. We can’t even use the expression builder to do the calculations to get a number of seconds, hours, days, etc and plug that result into the timer delay. I feel as if this node was misrepresented when it was advertised. It was my understanding we would be be able to set a date/time for the continuation of the workflow. But I most likely just misunderstood.

Tagging a few people to help get this feature enhanced, we really need the ability to trigger workflow on a specific date and time!! @sanofar.allahpichai @Casey B. Fingers crossed we can get this feature soon 🤞

My apologies if I had misled you Zachary. In my mind, the timer node was an analogous to a kitchen timer. I spent many years in restaurants before working in technology the timer was always a countdown to another step - pull the potatoes, change sanitation buckets, add the cream, or remove something from the oven, for example. To me, I often look at workflow automator as a recipe and the timer was there to ensure nothing got burnt or was started too early with the idea that everything comes out at the right time. 

Can you help me understand your use case for a date node in a workflow automation? This would only work one time, but maybe I am missing something. I can see day of the week, every other Wednesday, etc. but not Dec 10th, 2022. Time does make sense as well - say you want to occur at the start of business hours or 8PM. Is this what you mean by time?

Userlevel 7
Badge +13

Hello, 

I have requests from customers to be able change status at a given time. 
They want to add a date field to the forms and when an agenten sets specific date and time the ticket should set on pending and be reopened on that date and time.  If the time node would have had input field where we could use a placeholder from the form and not just hard set. 

 


Seen post about this but couldn’t find them. 

Here is a link to where there was some solutions as a way to build this out for the time being.

 

Ya I saw that but it’s for freshdesk :/  We have a customer that uses PS to make this. 

Userlevel 7
Badge +16

Hello, 

I have requests from customers to be able change status at a given time. 
They want to add a date field to the forms and when an agenten sets specific date and time the ticket should set on pending and be reopened on that date and time.  If the time node would have had input field where we could use a placeholder from the form and not just hard set. 

 


Seen post about this but couldn’t find them. 

Here is a link to where there was some solutions as a way to build this out for the time being.

 

Userlevel 7
Badge +16

@daniel.soderlund I have to agree with you that it would be nice to be able to set the timer node with a date/time instead of just a hard “elapsed” time delay. We can’t even use the expression builder to do the calculations to get a number of seconds, hours, days, etc and plug that result into the timer delay. I feel as if this node was misrepresented when it was advertised. It was my understanding we would be be able to set a date/time for the continuation of the workflow. But I most likely just misunderstood.

Tagging a few people to help get this feature enhanced, we really need the ability to trigger workflow on a specific date and time!! @sanofar.allahpichai @Casey B. Fingers crossed we can get this feature soon 🤞

Reply