- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 05:27 AM
Hi,
I have just started using my PDI instance. I am new to it. I have been learning from Youtube past 2 days.
While coding in PDI, even though I checked my code many times, its correct but still there is no results. Even gs.log doesn't work.
Is there any PDI setting that I must do?
I tried 2 coding stories both just doesn't show any results
What I did is created 3 fields in incident table as shown in screenshot. Requirement : Once "caller" is entered, then caller manager, caller mail and caller location should populate. I used below script include and client script but just nothing shows. Is there any PDI setting that i need to do on request of a new PDi?
Script include :
Script include
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 05:50 AM
There is issue with your script
Please refer this video for this
https://www.youtube.com/watch?v=MgXuzjNAei8&list=PLKH9bPqlw1neGCJbunoZl7ag-zYxyi8Oe&index=9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 06:19 AM
Hi @Deeplaxmi,
I saw in your client script you have used the string when calling the callback function, you need to pass callback function name directly, also when getting an answer to get value returned from script include you need to use "answer" instead of "ans" that is a syntax please try below in client script and check.. also i have placed an alert on ans variable so that you will be able to what answer is returning
Client script :
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var getcaller = g_form.getValue('caller_id'); //check the quotes
//gs.log('visited');
var gazax = new GlideAjax('Hope');
gazax.addParam('sysparm_name', 'Autopopu');
gazax.addParam('sysparm_value', getcaller);
gazax.getXML(Automa);
function Automa(response) {
var ans = response.responseXML.documentElement.getAttribute('answer');
var test = ans.split(',');
alert(ans);
g_form.setValue('u_caller_location', test[2]);
g_form.setValue('u_caller_manager', test[1]);
g_form.setValue('u_caller_email', test[0]);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 05:32 AM
Hi there,
Try to add debugging, to see if your script is triggered at all, if your script include is reached, up to where the script is running, from where the script is failing. Adding debugging will save you a massive amount of time. If then still stuck, no worries, just mention what you debugged and the details here, then we can help you further. Also saves us a lot of time 🙂
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 05:32 AM
This might also help you:
- 2020-10-21 - Blog - Q: Help!!! My code is not working! A: Did you debug your code?
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 05:43 AM - edited 01-30-2024 09:29 PM
Hi @Deeplaxmi,
I saw in your client script you have used the string when calling the callback function, you need to pass callback function name directly, also when getting an answer to get value returned from script include you need to use "answer" instead of "ans" that is a syntax please try above client script and check.. also i have placed an alert on ans variable so that you will be able to what answer is returning
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 05:50 AM
There is issue with your script
Please refer this video for this
https://www.youtube.com/watch?v=MgXuzjNAei8&list=PLKH9bPqlw1neGCJbunoZl7ag-zYxyi8Oe&index=9