- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 02:23 PM
I have extended the sc_req_item table to create a u_required_item table, which is related to a u_position table (similar to how sc_req_item is related to sc_request, u_position is an extension of sc_request). The idea is to allow people to define the required catalog items (including variables) for a particular position. I'll then send the position through approvals, then the required items, and then once approved that position will be available on our onboarding order guide. The goal is to script the addition of the sc_req_items based on what I found in the u_required_item table for the selected position.
In order to add catalog items to a position, I am currently doing the following:
On a position, you can click "Add required item". This deletes the user's carts and opens the catalog, where they can complete items and checkout. On the default Request level workflow, I am checking to see if the Request's parent is a Position. If it is, then I am updating the RITMs and moving them to the RI (required item) table. This is that script, in case it matters:
var r = new GlideRecord('sc_req_item');
r.addQuery('request',current.sys_id);
r.query();
while(r.next()){
var num = r.number;
var shortnum = num.substring(4);
var newNum = 'RI' + shortnum;
r.setValue('sys_class_name','u_required_item');
r.setValue('number',newNum);
r.setValue('request',current.parent);
r.setValue('parent',current.parent);
r.update();
}
This seems to be working without issues (minus needing to then close the catalog window and redirect them to the window in which they have the position open - haven't started tackling that yet). However, when I view the required item, I cannot see the variables on the form. I tried creating a custom variable editor outlined in this KB: ServiceNow KB: Determining whether the Variable Editor is added to a form (KB0538897) , but it still won't show. When I check the sc_item_option_mtom table, I can see entries for my required item. I'm at a loss as to how to resolve this issue.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 10:40 PM
Hi Kristen,
Check the "com_glideapp_servicecatalog_veditor" macro's eval_cat_item() function is been aligned with your custom table as well.
Please mark correct or helpful if this makes any impact!!!
Regards,
Rishi Reddy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 10:40 PM
Hi Kristen,
Check the "com_glideapp_servicecatalog_veditor" macro's eval_cat_item() function is been aligned with your custom table as well.
Please mark correct or helpful if this makes any impact!!!
Regards,
Rishi Reddy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2017 06:27 AM
Thanks! I appreciate the help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2018 01:13 AM
Hello.. i want to add variables editor to appoval table. can i do it? because when i edit ui macro and add
else if (className == "sysapproval_approver") {
cat_item = current.sysapproval.cat_item;
}
its doesn't work. approval form is empty. please help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2018 06:05 PM
I have come across the same issue when I updated the UI macro with the else if condition, but still it doesn't work. Is your issue resolved?
If so could you please reply back with the solution.
Thanks!