- 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
02-02-2024 05:36 AM
Yes, i had changed those names. Gav ethe names that were in sys_user table.
Thanks a lot for your help !!!!
- 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
02-02-2024 05:37 AM
Yes, I passed callback function directly and also corrected the 'answer' syntax. New things learned !!
Thank you so much for your assistance !!