- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 02:28 AM
Hey Folks,
I'm just learning and practising development, I'm unable to complete the Script include & client script, need your help.
Can someone help with what went wrong
Script Include :
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 11:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 11:39 PM
Hi @abjaffrey ,
Can you try to print your response in info message and see what it is returning.
Try g_form.addInfoMessage("object is : " + obj + " and length is: " + obj.length);
Please confirm what is being printed in the message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 11:56 PM
Thanks for the response, I've changed the client script as suggested but still no changes, after changing caller id the info msg dint show.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 06:54 AM
Hi @abjaffrey
Can you try this client script. I have change getXMLAnswer to getXML.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var finalArray = [];
var ga = new GlideAjax('getIncDetails');
ga.addParam = ('sysparm_name','getINC');
ga.addParam = ('sysparm_user_id',g_form.getValue('caller_id'));
ga.getXML(IncDetail);
function IncDetail(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
var obj = JSON.parse(answer);
for(var i =0;i<obj.length;i++){
finalArray.push('Incident Number : '+ obj[i].number +'\n'+'Priority : ' + obj[i].priority +'\n'+ 'Short Description : ' + obj[i].short_desc +'\n\n');
}
// g_form.setValue('description',finalArray);
g_form.setValue('description',finalArray);
}
}
In the script include Can you log the array before the return statment using gs.info('incArray: ' + incArray) to see if the script include returns any data or even runs at all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 07:49 AM
I've changed the codes as below but still no solution.
SI:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 11:08 AM