Calling script include from UI Script

Abhijit Das7
Tera Expert

Hi Everyone,

 

I am calling script include from UI Script. The script include is client callable and I placed gs.info in start of script include, but I cannot see gs.info in logs.

 

UI Script:

 
alert('This is test message');
var ar = new GlideAjax('x_cc_aa.myScriptInclude');
    ar.addParam('sysparm_name', 'setDetails');
    ar.addParam('sysparm_sysID', 'ed92e8d173d023002728660c4cf6a7bc');
    ar.addParam('sysparm_table', 'incident');
    ar.addParam('sysparm_contact_sysID', '77ad8176731313005754660c4cf6a7de');
    ar.getXMLAnswer(setURLCallback);

    function setURLCallback(response) {

        alert(response);
        var params = 'scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=1000,height=550,left=180,top=100';

        var newWin = top.window.open(response, '_blank', params);
        newWin.opener = null;
    }

Script Include:

var myScriptInclude = Class.create();
myScriptInclude .prototype = Object.extendsObject(global.AbstractAjaxProcessor, {

    setDetails: function() {

   var callUrl = "https://www.google.com/"
  return callUrl;

},
type: 'myScriptInclude '
});

 

 

Can we call script include into UI Script.

 

Thanks 

14 REPLIES 14

Ankur Bawiskar
Tera Patron
Tera Patron

@Abhijit Das7 

yes you can call

both UI script and script include are in same scope?

If not then if script include is in other scope then are you calling it with correct scope prefix? Is it made accessible from all application scopes?

share some details and screenshots.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar,

 

Yes, both UI script and Script Include are in same scope.

@Abhijit Das7 

unless your UI script is marked as global it won't run on form load etc

are you sure client callable checkbox is checked?

what's your actual business requirement?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar,

 

While creating UI script in scoped application, I don't see Global checkbox. Whereas when I try to create UI script in global then I can see Global checkbox.

 

Thanks