How to generate reminder email only on business days via workflow?

Raj Surve
Tera Contributor

Hello everyone,

 

We created a timer in workflow for generating reminder emails on daily basis.

But now, we want to trigger a reminder email via Workflow, only on business days, i.e. from Monday to Friday.

For that, we added a 'Wait-for-condition' in workflow, refer the screenshot attached.

find_real_file.png

We checked the script used here in the background script as well, and it was working fine, with proper result.

But when used in workflow, even on weekdays, the flow continues through wait-for-condition(returns true) till the end of workflow, hence generating a reminder email on Saturdays and Sundays as well, which is not expected.

 

Please let us know your thoughts.

 

Thank You.

1 ACCEPTED SOLUTION

Ian Mildon
Tera Guru

Use this script in the condition script box:

    (function() {  
      //run on weekdays only  
      var day = new Date().getDay();  
      return (day != 6 && day != 7);
    })(); 

View solution in original post

2 REPLIES 2

Kev9
Kilo Sage

Hi,

 

Can you include a schedule in your if condition using GlideSchedule?

https://developer.servicenow.com/dev.do#!/reference/api/rome/server/no-namespace/c_GlideScheduleScop...

or

Could you switch to Flow Designer and use a schedule within a wait condition?

 

Kev

Ian Mildon
Tera Guru

Use this script in the condition script box:

    (function() {  
      //run on weekdays only  
      var day = new Date().getDay();  
      return (day != 6 && day != 7);
    })();