Not able to Call Script Include From Client Script of a widget in Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 11:42 PM
Hi,
I have gone through various solution posted for calling Script Include from Client Script of a widget in Service Portal.
But didn't find accurate solution.
I have to call one SI to check login details.
Below is the CS.
function() {
/* widget controller */
var c = this;
//action.setRedirectURL("https://community.servicenow.com/community?id=community_question&sys_id=73e807a1db5cdbc01dcaf3231f96191f");
c.display = function() {
c.data.message = (c.data.uname) ? 'Hello ' + c.data.uname + '!' : '';
}
c.display();
c.check = function() {
var username = c.data.uname;
var password = c.data.psw;
alert('submitted' + username + password);
var validate = new GlideAjax('ValidateUserIDPassword');
validate.addParam('sysparm_name','checkCredential');
validate.addParam('sysparm_username',username);
validate.addParam('sysparm_password',password);
validate.getXML(getResponse);
function getResponse(response) {
var result = response.responseXML.documentElement.getAttribute("answer");
if(result == "true") {
alert('correct id ');
} else {
alert('invalid ') ;
return false;
}
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2018 12:22 AM
Hi
Please help with the configurations and SI code snippet. Is SI client callable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2018 06:34 AM
No SI is not callable but I am able to communicate between CS and Server Script of widge.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2018 12:28 AM
Hi,
I dont think you can call GlideAjax from client conrtroller as this is angular based & does not support GlideAJAX API.
What you can do here is call server script of widget itself from client controller & from there call your server side code i.e. script include.
https://serviceportal.io/communicating-between-the-client-script-and-the-server-script-of-a-widget/
Thanks
Gaurav