- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2020 02:32 AM
Hello,
There is a catalog client script written on a variable set that I've created on. And, have used the variable set in the catalog item as well as in the order guide.
Now the actual requirement is, I want the catalog client script to run only on the standalone catalog item form having the variable set and not on the order guide form (even if the order guide has that particular item in it) .
Could someone help me achieve this, please ? Thanks in Advance!!
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2020 03:39 AM
Can you try this for native UI:
$("sysparm_guide").value
for example:
if($("sysparm_guide").value){
return;
}
based on:
Or try:
g_request.getParameter('sysparm_guide')
Example:
if(g_request.getParameter('sysparm_guide')){
return;
}
Based on:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2020 03:39 AM
Can you try this for native UI:
$("sysparm_guide").value
for example:
if($("sysparm_guide").value){
return;
}
based on:
Or try:
g_request.getParameter('sysparm_guide')
Example:
if(g_request.getParameter('sysparm_guide')){
return;
}
Based on:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2020 02:35 AM
Hello
I tried both of the above scripts given by you (in native UI) but it throws up an error message right under the Primary Contact field in the catalog item form as shown below. However, the same works fine in Order guide.
Note - I've unchecked the "Isolate" field because of the usage of '$' in client script.
Error message on catalog item form -
Client Script -
function onChange(control, oldValue, newValue, isLoading) {
var orderGuide = $("sysparm_guide").value;
if (orderGuide == 'fb02172bdb0c6010e2aa874239961975')
return;
Info();
function Info() {
var ga = new GlideAjax('Caller_Information');
ga.addParam('sysparm_name', 'Caller_Details');
ga.addParam('sysparm_caller', g_form.getValue('primary_contact'));
ga.getXML(UserInfo);
//var customer = g_form.getReference('u_customer', setLocation);
}
function UserInfo(response) {
var answer1 = response.responseXML.documentElement.getAttribute("answer");
var answer2 = answer1.split(',');
if (answer1 != '') {
g_form.setValue('department', answer2[0]);
g_form.setValue('phone_number', answer2[1]);
g_form.setValue('email_id', answer2[2]);
}
}
}
Any thoughts in here would be of great help. Thank you!