Script Include and On change Client script using JS methods browser issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 05:21 AM - edited 10-31-2023 05:22 AM
Hi All,
I have a script include that returns the following result exactly as shown below with comma
"Development , Production"
Client Script (not working on Portal)
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.setVisible('column1',false);
g_form.setVisible('column2',false);
g_form.setVisible('column3',false);
return;
}
var prod = g_form.getReference('product');
//alert(JSON.stringify(prod));
//alert(prod.u_application_name);
var ga = new GlideAjax('<scriptincludename>');
ga.addParam("sysparm_name", "getCI");
ga.addParam("sysparm_app_name", prod.u_application_name);
ga.addParam("sysparm_sysid", newValue);
//alert(newValue);
//alert(newValue.getDisplayValue());
ga.getXML(getResponse);
function getResponse(response) {
var res = response.responseXML.documentElement.getAttribute("answer");
alert(res.toString());
//var res1 = res.toString();
if(res.includes('Development')){
g_form.setVisible('column1',true);
g_form.setVisible('column2',true);
}
if(res.includes('Production')){
g_form.setVisible('column2',true);
g_form.setVisible('column3',true);
}
}
}
"
Now I need to have a client script to check the matches of the above returned results which is Dev/ Prod. I have the below script which works on Native UI but not on the Portal. It displays an error "There is a JavaScript error in your browser console "
I need help to make it compatible and make it work on the Portal as expected.
@Danish Bhairag2 @Sandeep Rajput @Ankur Bawiskar @Peter Bodelier @Chuck Tomasi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 05:30 AM
@Anne Marie Duff @Daniel Draes @Ian Leu
Can you please help me with the above request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 05:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 05:50 AM
Yes I have and I tried to add a callback func for getreference however it didn't work either
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 05:51 AM