- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2017 04:58 AM
Hey,
Does anyone know how can I tell, when I'm inside an order guide in service portal, what is the item sys_id (not the order guide sys_id)?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2017 10:33 PM
g_form.getUniqueValue() will provide you with catalog item sys_id.
catItem = $("sysparm_id").value; -----> catItem = g_form.getUniqueValue() ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2017 09:37 AM
All included items stored in an array data._items . Traverse over items and data._item[i].sys_id will provide the sys_id of each item. You could simply log all the data to browser console simply by selecting ctrl + rc ---> log scope.data on any widget.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2017 11:02 AM
Thanks for the quick replay Gurpeet, but is there a why to get the sys_id of an item when I'm in a catalog client script?
I have scripts that usesthe sys_id of the item with the hidden input of the order guide (sysparm_id, or current_item) is there a alternative for service portal?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2017 09:16 PM
Is this script on Order Guide itself or on one of catalog items ? Can you please paste the script ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2017 09:29 PM
the problem in this catalog client script is that it's running on a variable set:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var catItem;
if ($("sysparm_id")) // tryin to find the current item sys_id in order to pass it to script include - work inside the system but not in the service portal
catItem = $("sysparm_id").value;
else if ($("current_item"))
catItem = $("current_item").value;
var ga = new GlideAjax('TVA_populateServiceOfferingVar');
ga.addParam('sysparm_name','getCIofferingsAggregate');
ga.addParam('sysparm_ci',g_form.getValue('u_customer_ci'));
ga.addParam('sysparm_user',g_form.getValue('caller_id'));
ga.addParam('sysparm_cat_item',catItem);
ga.getXML(offerNumParse);
function offerNumParse(serverResponse) {
var res = serverResponse.responseXML.getElementsByTagName("res");
var count = res[0].getAttribute("value");
if (count < 2 ){
var offer = res[1].getAttribute("value");
g_form.setValue('service_offering',offer);
g_form.setReadOnly('service_offering',true);
g_form.setDisplay('service_offering',false);
}
else{
g_form.setDisplay('service_offering',true);
g_form.setReadOnly('service_offering',false);
g_form.setValue('service_offering',"");
}
}
}