Thank you for responding.  Yes, I am referencing the scope that I'm in from the script include - and I added some alerts in the client script so I could see values as they get added - and this all works.  However, it just seems to be on the script include side - where I instead tried things like looking up the email of the client (customer_client) and it returned the value as expected.  Just when I run a query against a custom table in the script include does it seem to ignore the return field.  I checked for typos etc. and it all appears to correct.  Here is my client script:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }

    var romSysID = g_form.getValue('u_quote_rom_assumptions');
   
    alert(romSysID);
    var ga = new GlideAjax('global.getROMAssumptionsInfo');
    ga.addParam('sysparm_name', 'romAssumptionsDetatils');
    ga.addParam('sysparm_value', romSysID);
    ga.getXML(getResult);

    function getResult(response) {
        alert(response);
        var answer = response.responseXML.documentElement.getAttribute("answer");
        alert(answer);
        g_form.setValue('u_quote_rom_assumptions_content', answer);

    }

}

@JohnnieGross 

any query business rule on that custom table which restricts the record in query?

is your client script getting value from script include for admin user?

Is the script include itself getting called?

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

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

I do not have any query business rules on the table - and the client script is calling the script include.  If I tweak the script include, for example, to query a different table and return a different value from that table (where the table is not customer and does not begin with "u"), then the client script to the script include works perfectly well.  It's just when I try to query the custom table and cannot see where or how the call from the script include would not be able to run the query and return the value.

Nishant8
Tera Sage

Hello @JohnnieGross, Can you please try to execute the SI from Background Script and verify whether you receive desired output?

you can make your SI callable from CS and Background script with a small change as below:

var getROMAssumptionsInfo = Class.create();
getROMAssumptionsInfo.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    romAssumptionsDetatils: function(customSysID) {
        var cr = this.getParameter('sysparm_value') || customSysID;     
        var gr = new GlideRecord('u_rom_assumptions');
        gr.addQuery('sys_id', cr);
        gr.query();
        if (gr.next()) {
            return gr.u_rom_assumptions_details;
        }
    },
    type: 'getROMAssumptionsInfo'
});

JohnnieGross
Tera Expert

I was able to resolve my issue.  Apparently, if the lookup table is made in the Global scope and has the prefix of "u_", then it will not work.  I recreated the table in the application Quote Management Data Model, the system prefixed the table with the prefix for Quote Management and therefore is added to an Application.  Once I did this an updated all my references to that new lookup table and updated the Script Includes, it started working.  I'm not sure why this particular functionality was ignoring a table made in Global, I'm not sure.  But it's working for me now.  Thanks to everyone who helped me navigate this issue.

JohnnieGross_0-1743695215156.png

 

View solution in original post