- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2019 05:26 AM
Hi Folks,
Requirement : For Testing Purpose , I am looking to add a button on the catalog item form, which when cliked should prompt for a RITM number, which then populates the values from that RITM to the current ctalog variables. so that for testing purpose I can avoid filling of values.
Any Ideas towards this is greatly appreciated.
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2019 05:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2019 01:37 AM
I mean ..
I have created a Catalog Item in DEV.....and it gets captured in the Update Set.....
1) but for testing purpose I need to have that variable set copy_request in the catalog item as well . (DEV)
2) In Test I will move this update set .....bu I dont want to have that copy_request functionality in test
3) so do I need to modify the catalog item ....(removing the copy_request) every time (for all the catalog items) before moving it to test....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2019 02:26 AM
I see what you mean. If the Copy request functionality is only needed in DEV so you can speed up testing then you have a couple of options
1. As you suggested, add the functionality in the catalog item that you are developing in DEV and when done just remove the field from the variable set or form
2. Leave the field in the variable set but hide it in the catalog item form. You could create a catalog client script that would apply to a variable set not a catalog item. The type would onLoad and the Variable set would be your variable set. This means that you don't need to remove the variable before promoting to TEST and PROD.
In the script you could just say something like below so it only shows for admins. If you go with this consider that this variable will try to load every time a form containing it will open and the script will run so it is not showed to other users. Consider that this might slow down the form load if there are a lot of other catalog client scripts running on it.
function onLoad() {
var userRole = g_user.hasRole('admin');
if(userRole == true){
g_form.setDisplay('copy_request', true);
}
else{
g_form.setDisplay('copy_request', false);
}
}
Also, please mark the reply as correct and close the thread, so that other users can refer the correct answer.
best regards
Bogdan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2019 05:39 AM
Hi Harish,
Thanks for the response, I understand that we can extract the value from mtom table, but my main concern is how can I create a button on the header form. with a UI action.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2019 06:46 AM
Hi Rahul,
Create a UI Action - Copy Service Request
Use script:
var variableName = '';
var variableValue = '';
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
item = cart.addItem(current.cat_item);
var scVar = new GlideRecord("sc_item_option_mtom");
scVar.addQuery('request_item', current.sys_id);
scVar.query();
while(scVar.next()){
variableName= ''+scVar.sc_item_option.item_option_new.name;
variableValue= ''+scVar.sc_item_option.value;
gs.print("variableName :"+variableName+' variableValue '+variableValue)
cart.setVariable(item,variableName,variableValue);
}
var rc = cart.placeOrder();
gs.addInfoMessage("You request has been raised and request number is "+rc.number);
cart.deleteCart();
Please mark correct if you found this helpful.
Thanks,
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2019 07:32 AM
UI Action on which table ???