
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2021 10:15 AM
Hi Experts,
My goal is to be able to call a server script with glideAjax from a catalog client script, which related to a record producer. right now I'm getting null as an answer (from the glideAjax) and also my logs on the script include are not executed.
Please help, what am I missing?
record producer:
catalog client script :
script include:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2021 04:22 PM
solution.
calling isPublic() solved the issue.
Reference:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2021 01:58 PM
var symptom_category = g_form.getValue('subcategory');
var gaSymptomCode = new GlideAjax('sn_customerservice.IND_Symptoms_tst');
gaSymptomCode.addParam('sysparm_name', 'IND_Symptom_code_RP_function');
gaSymptomCode.addParam('sysparm_symptom_category', symptom_category);
gaSymptomCode.getXMLAnswer(getAnswer);
function getAnswer(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
}
The above is invalid code getXMLAnswer natively calls to the answer attribute, doing it twice will result in an invalid object. The below will work to generate an alert message based on the response.
I've used "new_value" as your script is running onChange of the category variable so you don't need to seperately use g_form to get its value.
var gaSymptomCode = new GlideAjax('sn_customerservice.IND_Symptoms_tst');
gaSymptomCode.addParam('sysparm_name', 'IND_Symptom_code_RP_function');
gaSymptomCode.addParam('sysparm_symptom_category', newValue );
gaSymptomCode.getXMLAnswer(function(response){
alert(response);
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2021 02:08 PM
Hi Anson,
I tried it also and it didn't help.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2021 02:11 PM
Quick testing.
Can you try to create a script include in global scope and set accessible for all application scope.
Also best practice,your function name should not be so long.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2021 02:18 PM
I tried it. it didnt help

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2021 02:21 PM
Hmmm.. Can you try this way?
Create new script include and client script.
Just add log and return "hello" from your script include .
then check the log and see if its coming or not.