Unable to call script include from reference qualifier

Andrew158
Giga Guru

Hello,

 

I am trying to create an advanced reference qualifier that calls a script include for a form field, however I have not been able to hit my script include yet.

My reference qualifier is:

 

javascript: new AMSFromSpaceRefQual().getSpaceEntitlements(current.variables.user);

 



And my script include:

 

var AMSFromSpaceRefQual = Class.create();
AMSFromSpaceRefQual.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    initialize: function() {},

    getSpaceEntitlements: function(userSysID) {
        gs.info('AMSFromSpaceRefQual.getSpaceEntitlements called with userSysID: ' + userSysID);

        var spaceSysIDs = [];
        var userAssignedSpaces = new GlideRecord('x_nuvo_eam_users_assigned_to_location_m2m');
        userAssignedSpaces.addQuery('user', userSysID);
        userAssignedSpaces.query();
        while (userAssignedSpaces.next()) {
            var spaceSysID = userAssignedSpaces.space.getUniqueValue();
            gs.info('Found spaceSysID: ' + spaceSysID);
            spaceSysIDs.push(spaceSysID);
        }

        var result = 'sys_idIN' + spaceSysIDs.join(',');
        gs.info('Returning query: ' + result);
        return result;
    },

    type: 'AMSFromSpaceRefQual'
});

 

 

My script include is client callable and in the same scope as my variable. I have not yet been able to see any of my gs.info() statements in the application log, so it seems my script include is never being invoked at all.

Some things I've tried:

  • Using the full API Name for my script include in my reference qualifier (javascript: new x_nuvo_eam.AMSFromSpaceRefQual().getSpaceEntitlements(current.variables.user);
  • Passing a static value from the reference qualifier instead of (current.variables.user);


Any insight into how I can get this working would be greatly appreciated, thanks.

Edit: Both the user variable I am passing to the script include, as well as the variable my reference qualifier is on, are both part of a multi-line variable set, in case that changes something

10 REPLIES 10

Bert_c1
Kilo Patron

Seems you need to post a screenshot of the script include, showing the fields on the form above the script.

Hello Bert,

 

That information is in all in my post, with the exception of 'Accessible from', which is This application scope only. Please note though that my catalog item and variables are in the same scope as my script anyways.

Andrew158_0-1715881368663.png

 

Thanks,

Andrew

Bert_c1
Kilo Patron

Alli I can suggest is you make the script include accessible from "All application scopes", since you've tried using the 'API Name' in your reference qualifier. And details on the field the reference qualifier is defined on. I frequently add debug 'gs.info();' as you have in my scripts, and then search in 'Script log statements' module for the result.

Thank you for the suggestion. Unfortunately, making the script include accessible from all application scopes does not seems to have fixed the issue, as I still am not getting any of my logs.