- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 11:15 PM
クライアントスクリプトでGlideAjaxを用いてスクリプトインクルードを呼び出したいのですが、うまく動作しません。ログも表示されないです。どうすれば正常に動作するでしょうか。
//Client Script
function onLoad() {
//Type appropriate comment here, and begin script below
g_form.addInfoMessage('text');
var case_sysid = g_form.getValue('u_case');
var ga = new GlideAjax('global.cscRelatedcaseinformationoutput');
ga.addParam('sysparm_name', 'serverFunc');
ga.addParam('case_sysid', case_sysid);
g_form.addInfoMessage(case_sysid);
ga.getXML(callback);
function callback(response) { // Script Includeの処理結果がresponseに渡される
var answer = response.responseXML.documentElement.getAttribute("answer"); // XML構造の中から結果を取り出す
g_form.addInfoMessage('callback ' + answer);
g_form.setValue('caller_id', case_contact);
}
}
//Script Include
var cscRelatedcaseinformationoutput = Class.create();
cscRelatedcaseinformationoutput.prototype = Object.extendsObject(AbstractAjaxProcessor, {
initialize: function() {},
serverFunc: function() {
gs.info('AX');
var case_sysid = this.getParameter('case_sysid');
gs.info('case_sysid ' + case_sysid);
var gr = new GlideRecord('sn_customerservice_case');
gr.addQuery('sys_id', case_sysid);
gr.query();
gs.info('query ' + gr.getRowCount());
while (gr.next) {
gs.info('case_contact ' + case_contact);
var case_contact = gr.getValue('contact');
return case_contact;
}
},
type: 'cscRelatedcaseinformationoutput'
});
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 11:53 PM
Do not overwritte its method initialize as extending AbstractAjaxProcessor, remove it from your code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2024 03:20 AM
You are missing the parenthesis in the next method call that could prevent this script from executing
while (gr.next()) {
I don't think this matters, but Client callable / Glide AJAX enabled Script Includes do not have/need an initialize function. Beyond this, are you getting the two infoMessages on the incident, with the correct case sys_id?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2024 04:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 11:53 PM
Do not overwritte its method initialize as extending AbstractAjaxProcessor, remove it from your code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2024 04:10 PM
具体的にはどの部分を削除すればいいですか?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2024 03:20 AM
You are missing the parenthesis in the next method call that could prevent this script from executing
while (gr.next()) {
I don't think this matters, but Client callable / Glide AJAX enabled Script Includes do not have/need an initialize function. Beyond this, are you getting the two infoMessages on the incident, with the correct case sys_id?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2024 04:29 PM
スクリプトを一部修正しましたが、問題は解決していません。
//Client Script
function onLoad() {
//Type appropriate comment here, and begin script below
g_form.addInfoMessage('text');
var case_sysid = g_form.getValue('u_case');
var ga = new GlideAjax('global.cscRelatedcaseinformationoutput');
ga.addParam('sysparm_name', 'serverFunc');
ga.addParam('case_sysid', case_sysid);
g_form.addInfoMessage(case_sysid);
ga.getXML(callback);
function callback(response) { // Script Includeの処理結果がresponseに渡される
var answer = response.responseXML.documentElement.getAttribute("answer"); // XML構造の中から結果を取り出す
g_form.addInfoMessage('callback ' + answer);
g_form.setValue('caller_id', answer);
}
}