- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2022 08:13 AM
Hello,
We have 2 order guides where for specific items they need to show/remove specific fields. I've created a client script but need to specify an actual order guide however doesnt seem to be working. Any help would be appreciated.
function onLoad() {
var isOG = g_service_catalog.isOrderGuide(); //Checks if order guide
if(!isOG && g_form.getValue('95d3b7a9974ed150b34b7a671153af55')){ //checks for specific order guide
g_form.setDisplay('business_justification', false); //if yes - Doesnt show field
}else{
g_form.setDisplay('business_justification', true); // if no - Shows field.
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2022 09:01 AM
Hi
Try this updated scripts -
For native UI- get sysparm_guide
For portal UI - get sys_id
Note - Isolate Script field is set to false for this client script.
function onLoad() {
var url = top.location.href;
var orderGuideSysId;
if (window == null) {
// for portal
orderGuideSysId = new URLSearchParams(url).get("sys_id");
} else {
// for native
orderGuideSysId = new URLSearchParams(url).get("sysparm_guide");
}
// alert(orderGuideSysId);
var isOG = g_service_catalog.isOrderGuide(); //Checks if order guide
if (orderGuideSysId == 'add_sys_id_here') { //checks for specific order guide
g_form.setDisplay('business_justification', false); //if yes - Doesnt show field
} else {
g_form.setDisplay('business_justification', true); // if no - Shows field.
}
}
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2022 09:01 AM
Hi
Try this updated scripts -
For native UI- get sysparm_guide
For portal UI - get sys_id
Note - Isolate Script field is set to false for this client script.
function onLoad() {
var url = top.location.href;
var orderGuideSysId;
if (window == null) {
// for portal
orderGuideSysId = new URLSearchParams(url).get("sys_id");
} else {
// for native
orderGuideSysId = new URLSearchParams(url).get("sysparm_guide");
}
// alert(orderGuideSysId);
var isOG = g_service_catalog.isOrderGuide(); //Checks if order guide
if (orderGuideSysId == 'add_sys_id_here') { //checks for specific order guide
g_form.setDisplay('business_justification', false); //if yes - Doesnt show field
} else {
g_form.setDisplay('business_justification', true); // if no - Shows field.
}
}
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2022 02:22 AM
Amazing! Thank you.