This is a project which have been lying around for a long time and never got to write the end result.
Since I got a new surface 3 pro, decided it is always a nice time to clean you up when starting on a new machine.
So started looking at unfinished projects and blogs and decided, if still valid post them!
A common asked requirement during Service Manager projects is the ability to automatically schedule work items.
There are some custom solutions to provide a similar experience for automatically scheduling work items.
All these solutions require deep knowledge on XML and some of them even code, not really user friendly unless you are a XML geek
Because this requirement pops up now and again and there is no real user friendly solution I decided to write a custom solution to provide scheduling of work items as easy as creating any other template in SCSM!
Currently the following Work Items can be scheduled – Incidents, Change Requests and Service Requests.
How does it work?
You create a Schedule for when to auto create the work item:
You name the schedule and give it a Run date and interval.
The Run date is from when the scheduling should occur like Monday 06/01/2015 <—This needs to be a future date when you want to run the schedule for the first time!
Interval in days is 2 so next run date will be 06/03/2015.
After this A workflow will recalculate the next run date which would be 06/03/2015 + 2 = 06/05/2015 and so on.
The idea behind the solution is you create a Template of your work item (just like you normally would and save the template in the accompanied management pack – Schedule Work Item Templates (Schedule.Workitems.Templates.xml). (crucial to save it in this MP!)
When you create the template you relate the template to the preferred schedule :
Save the template and that’s it!
Now the next scheduled run date a workflow will create the scheduled work item!
The following workflows are running for the automatic scheduling of work items:
- Schedule Apply Template, this workflow will apply the template as defined in the management pack Schedule Work Item Templates.
- Schedule Change Display Name, this workflow which changes the display name of the schedule to a readable one. This one is required to easily identify the correct schedule when relating them to a template as shown in figure 5.
- Schedule Next Rundate, this workflow will change the next run date based on the last run date and the interval.
Schedule Apply Template workflow, by default this will run at 8 AM from Monday till Friday.
Schedule Next Rundate Workflow, by default this will run at 9 AM From Monday till Friday.
If you want to change the timings of the workflows when they will run you can change these in the XML.
Be aware to always trigger the ScheduleNextrundate AFTER the Applytemplate workflow!
To change the timings you can change the following scheduler section for both workflow rules:
After changing the workflow you need to seal the management pack again and create a MPB.
With the following Files:
Existing Templates tip
If you want to add the schedule functionality, just duplicate the template and save it in the management pack Schedule.Workitems.Templates.xml and add a schedule to the template.
Simply import the MPB and copy the workflow file to the service manager directory (Default:C:\Program Files\Microsoft System Center 2012 R2\Service Manager)