- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2017 02:34 PM
Hi Everyone,
I'm new to the community and eagerly learning lots about this amazing platform.
I have an excel file that I'm importing into a custom table. The excel file has 4 columns full of data and about 100+ rows of data in it. From that excel file, I need each row to automatically create a new REQ (and subsequent RITM, TASK).
I also need to populate four variables on the catalogue item as I add it to the cart from the columns in the excel sheet.
I'm starting with this code and just am unsure how to populate the catalog item's variables in the script based on the excel sheet import.
Business Rule
When: after
Insert/Update/Delete: true
Condition: <your_condition_here>
createRequest();
function createRequest() {
//Create Request
var cart = new Cart();
//substitute your cat item
var item = cart.addItem('00000000000000000000000000000000');
//Set Variables in your Cart Item
//substitute your req for
cart.setVariable(item, 'requested_for','00000000000000000000000000000000');
cart.setVariable(item, 'request_short_description', 'Created from Business Rule');
cart.setVariable(item, 'request_description', 'Created from Business Rule');
cart.setVariable(item, 'request_type', 'others');
var rc = cart.placeOrder();
cart.description = 'servicenowelite.com';
var rc = cart.placeOrder();
gs.addInfoMessage('Request Item Created: ' + rc.number);
}
Source:
http://www.servicenowelite.com/blog/2014/2/6/request-generation-methods
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2017 03:43 PM
Thanks for the update Chirs. Try to include the line ignore = true; after var rc = cart.placeOrder(); and check once.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2017 03:43 PM
Thanks for the update Chirs. Try to include the line ignore = true; after var rc = cart.placeOrder(); and check once.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2017 04:02 PM
Much appreciated - that did it!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2021 10:37 AM
Hi Pradeep,
I have the same requirement that Request had to create through the Excel sheet with transform script process.
I tried the way that you suggested, but i got failed to get the variables in the RITM.
Can you help me with the Bullet points from 1 to End that needs to be done to get the request to achieve.
Thanks and Regards,
Vinod.