Not able to Call Script Include From Client Script of a widget in Service Portal

sushil sinha
Giga Contributor

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;
}
}
}

}

3 REPLIES 3

Omkar Mone
Mega Sage

Hi 

Please help with the configurations and SI code snippet. Is SI client callable?

No SI is not callable but I am able to communicate between CS and Server Script of widge.

Gaurav Bajaj
Kilo Sage

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