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

Hi @Andrew158,

 

Sure I helped to how far script include is working and now check your logic to make it for correct result. 

 

Please accept my solution if it resolves the query or thumbs up

 

Thanks 

Jitendra 

Please accept my solution if it works for and thumps up.