How to create a catalog item from an item in a table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2016 01:27 PM
I created my own application with a table that I've populated with information. I want to create a catalog item from any of those records I've created. I have a UI Action that says "create catalog item" inside of the table, but I'm not sure how to script it. Help??
- Labels:
-
Integrations
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2016 01:53 PM
Okay that is something to look into.
I was also thinking of a different route: directly creating a catalog item
from the custom table instead of having to go through the record producer.
So if I have a related link named "Create Catalog Item", then I click on
that and it directs me right to a catalog item form. Kind of like the
Amazon AWS Cloud --> Approved Images --> Create Catalog Item
On Tue, Aug 23, 2016 at 1:47 PM, sourabhd87@gmail.com <
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2016 02:10 PM
If you want to create a request item, then create a new cart
Service Catalog Script API - ServiceNow Wiki
eg:
//////////////////////// HAVE THIS IN SCRIPT INCLUDE ///////////////////////////////
var cart = new Cart();
var item = cart.addItem("8593a984663456767688783918172050e36"); // sys_id of the catalog item should be entered.
cart.setVariable(item, 'requested_by', '5443453455354534534566788'); // Set you own variable to appear in new catalog item. I have shown just as an example
cart.setVariable(item, 'requested_for', ''089877654322467986743435); // Set you own variable to appear in new catalog item I have shown just as an example
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=8593a984663456767688783918172050e36';
url += '&sysparm_cart_edit='+item;
return url;
///////////////////////////////////////////////////////////////////////////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Call above in a client side UI Action\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
In the client side call the above srtipt using ajax and set window location with the returned answer
window.location = url; //change url to the answer returned
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Kind regards,
Sourabh D
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2021 08:47 PM
It is quite easy.
- First things first, make sure that the table that you have created extends 'sc_cat_item' table and both the tables i.e. your_table and sc_cat_item table have all the necessary fields in common.
- Enter records for your_table.
- Create a flow using the flow designer.
- Trigger - schedule based
- Action - Lookup for records (Lookup for records in your_table)
- Flow Logic - For each (using the data pill picker - refer the records looked up in the previous step)
- Action - Create a record - (sc_cat_item table - To validate field values, refer to the fields of the record in the for each flow logic)
You are done! Now you can save, activate and test the flow.
Let me know if this works for you.