- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2014 01:57 PM
Hey Everyone!
Quick question for anyone who has experience with this.
I am trying to automate a checklist for our network security team.
I have built a catalog item, created an execution plan that contains all the tasks required, and all of that works perfectly fine and well.
However I seem to be having issues trying to "schedule" this item using the Scheduled jobs which seems to be driven off templates.
I tried to create a template with all the right values, the only issue is it creates an item (with no parent request) and my Execution plan does NOT get applied.
Any creative ideas or pointers in the right direction would be enormously helpful.
Thanks!!
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2014 03:21 PM
I would have used a Workflow instead of the Execution Plan, but that is OK
What you would need to do is use the Service Catalog Script API - Service Catalog Script API - ServiceNow Enterprise Wiki
Select the "System Definition \ Scheduled Jobs" Module and click on the New button in the list header. Then click on the "Automatically run a script of your choosing" option:
Use the following example code:
(function(){
var cart = new Cart();
var item = cart.addItem("e2132865c0a8016500108d9cee411691");
cart.setVariable(item, "replacement", "Yes");
cart.setVariable(item, "original", "555-123-4567");
cart.placeOrder();
})();
The sys_id you see on the 3rd line is for the example BlackBerry Z10 catalog item. Replace it with the sys_id of your catalog item. It sets two variables and then orders the item.
Your Scheduled Script Execution record should look similar to this:
Set your scheduling info and you are set. Click on "Execute Now" to try it out. This will create the Request and Requested Item records for you. If you need some special scheduling conditions on the Scheduled Job, check out this post - Custom Discovery Schedule with a Condition Script
You could even add the "Run as" field to the form and specify a particular user if you want to have that user as the "Requested for" on the Request. You can see it in demo015 at the moment (for the next 23 hours or so).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2014 03:21 PM
I would have used a Workflow instead of the Execution Plan, but that is OK
What you would need to do is use the Service Catalog Script API - Service Catalog Script API - ServiceNow Enterprise Wiki
Select the "System Definition \ Scheduled Jobs" Module and click on the New button in the list header. Then click on the "Automatically run a script of your choosing" option:
Use the following example code:
(function(){
var cart = new Cart();
var item = cart.addItem("e2132865c0a8016500108d9cee411691");
cart.setVariable(item, "replacement", "Yes");
cart.setVariable(item, "original", "555-123-4567");
cart.placeOrder();
})();
The sys_id you see on the 3rd line is for the example BlackBerry Z10 catalog item. Replace it with the sys_id of your catalog item. It sets two variables and then orders the item.
Your Scheduled Script Execution record should look similar to this:
Set your scheduling info and you are set. Click on "Execute Now" to try it out. This will create the Request and Requested Item records for you. If you need some special scheduling conditions on the Scheduled Job, check out this post - Custom Discovery Schedule with a Condition Script
You could even add the "Run as" field to the form and specify a particular user if you want to have that user as the "Requested for" on the Request. You can see it in demo015 at the moment (for the next 23 hours or so).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2014 09:06 PM
Did this help you out? If so, can you mark the question as being answered so other Community members know that it is a good solution? Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2014 01:11 PM
Jim thank you so much for your suggestion, I gave this a try and it was perfect!
Cannot thank you enough for your quick and extremely well written response. Have a wicked day!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2014 01:14 PM
You are welcome!