Script Include

sarika ponnagan
Tera Contributor

In my PDI script Include is not running, while i verified in background script the code is working fine, Created script include and added script include in on change client script, the script include itself not working in my PDI, may i know the reason behind this

1 ACCEPTED SOLUTION

@sarika ponnagan Try this 

var Ifuserismanager = Class.create();
Ifuserismanager.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    isUserManager: function() {
        gs.log("checking the manager");
        var userId = this.getParameter('sysparm_user_sys_id');
        var grReportee = new GlideRecord('sys_user');
        grReportee.addQuery('manager', userId);
        grReportee.setLimit(1);
        grReportee.query();
        if (grReportee.next()) {
            gs.log("user is manager");
            return true;
        }
        gs.log("user is not a manager");
        return false;
    },
    type: 'Ifuserismanager'
});

✔️ If this solves your issue, please mark it as Correct.


✔️ If you found it helpful, please mark it as Helpful.



Shubham Jain


View solution in original post

15 REPLIES 15

Ankur Bawiskar
Tera Patron
Tera Patron

@sarika ponnagan 

So GlideAjax is not working.

Things to check

1) script include and client script are in same scope

2) script include is client callable

3) you are following correct GlideAjax syntax

GlideAjax Example Cheat Sheet 

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

Nikhil Bajaj9
Giga Sage

Hi @sarika ponnagan ,

 

Try to save your script include again and see at top you are getting message - Script include inserted. Then try again. If still nmot working, share screenshots.

 
Reagrds,
Nikhil Bajaj
Please appreciate my efforts, help and support extended to you by clicking on – “Accept as Solution”; button under my answer. It will motivate me to help others as well.
Regards,
Nikhil Bajaj

Shubham_Jain
Mega Sage

@sarika ponnagan  Is only specific Script Include is not working or None of SI is not working? 

 

✔️ If this solves your issue, please mark it as Correct.


✔️ If you found it helpful, please mark it as Helpful.



Shubham Jain


sarika ponnagan
Tera Contributor

Same thing i did for on change client script for incident, Its not worked.
My criteria here is in catalog item in user reference selection field, when selected user is a manager for anyone, then its should show the popup, For this use case i tried like below mentioned screenshots, with using script include and catalog client script