Scheduled Job for a task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello All ,
I have created an item in Snow and a task .
I have set the initial state of this task at 'On Hold' .
I want to change this state automatically from a date time (DD/MM/YYYY HH:MM) .
If this date is reached , the task will change the state from On hold to Active for example .
Could you please tell me if there is an existing field in the catalog tasks table or a buit-in solution to manage the scheduled job for a task ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @KouassiP
If you are using Flow designer -Flow , in that case,
Refer: KB0958213 Resolve stuck wait-for-condition action based on a date in Flow Designer
Resolution
For date and time monitoring, use the duration action instead of wait-for-condition. The duration action can detect when a date or time is reached without requiring the source record to be updated.
refer KB: KB3018993 Flow Designer: How to Wait Until Change Request Planned Start Date/Time ( it is on CR , just check the concept)
For legacy workflow - it would be Wait for condition workflow activity
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @Tanushree Maiti , first of all we don't use flow designer and i don't find the wait for condition workflow activity in my Snow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @KouassiP ,
If you're using Flow Designer, the recommended approach is to use a Wait for Duration or Wait Until Date/Time action rather than relying on a scheduled job or a Wait for Condition. Once the specified date/time is reached, add an Update Record action to change the Catalog Task state from On Hold to Open (or the required state).
If you're using the legacy Workflow, you can use the Wait for Condition activity.
There isn't an out-of-the-box field on the Catalog Task (sc_task) table that automatically changes the state when a date/time is reached—you'll need to implement this using Flow Designer, a Scheduled Script Execution, or a Workflow.
The KB articles shared above are a good reference, especially the guidance to use a duration/date-based wait instead of a wait-for-condition when monitoring a date/time value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hey @KouassiP
The recommended approaches are as follows:
Option 1: Scheduled Script Execution
Script:
var taskGR = new GlideRecord('sc_task');
taskGR.addQuery('state', 3); // On Hold
taskGR.addQuery('u_resume_date', '<=', gs.nowDateTime());
taskGR.query();
while (taskGR.next()) {
taskGR.setValue('state', 2); // put state value
taskGR.update();
}
Option 2: Flow Designer
If your instance uses Flow Designer, you can implement this without custom scheduled scripts.
A typical flow would be:
Trigger: Record Created or Updated on sc_task
Condition: State = On Hold and Resume Date is populated
Wait Until: Resume Date/Time
Update Record: Change State to Active/Open
This is generally the preferred low-code solution for newer implementations.
Option 3: Service Catalog Workflow (Legacy)
If your catalog items still use the legacy Workflow Editor, you can add a Timer activity to pause the workflow until the desired date/time and then update the associated Catalog Task state.
This approach works well for existing workflow-based catalog items but is generally not recommended for new implementations, where Flow Designer is preferred.
*************************************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.
Regards
Vaishali Singh
Servicenow Developer
Linkedin - https://www.linkedin.com/in/vaishali-singh-2273361bb