Workflow - how to create Task at certain date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2015 10:46 PM
Hi all,
we would like to create CatalogTask in workflow. The speciality is, that we want to create CatalogTask at certain date (this date will be taken from catalog variable), so the workflow should somehow stops and waits until the current day is equal to date on catalog variable.
I would like to ask you what is the best way of creation CatalogTask in workflow at certain date.
Our idea is to use "Wait for condition" activity and create scheduled job which will check once a day if catalog variable of this requested item is equal to "Today" and then trigger workflow update with wf.runFlows(requested_item, 'update');
What do you think about this approach & do you have any better suggestions?
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2015 11:58 PM
There are couple of ways suggested in this thread to schedule something in future ..
One is the event and the other is scheduleonce option .. I suggest you try the eventQueueScheduled option here...
Add a wait condition in the workflow and create the task using one of the approaches presented in the thread
https://community.servicenow.com/message/737459#737459
Hope that helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2015 12:21 AM
Peter,
What you can do is to have a Timer activity and have the 'Timer based on' 'Script'.
Script will be something like:
answer = 0;
var gdt = new GlideDateTime();
//date is the field name of the Date variable
gdt.setDisplayValue(current.variable_pool.date.getDisplayValue());
var start = gdt.getNumericValue();
var currentDate = new GlideDateTime();
var currentSeconds = currentDate.getNumericValue();
answer = ((start - currentSeconds)/1000);
So, now the Timer will wait till that date and then Workflow will create the Catalog Task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 09:52 AM
What if I need the tasks to create one day before the schedule date?
For example, if the schedule date is 12/31 I want the tasks to create on 12/30.
Thank you.