Reference Qualifier is returning all the records while it should suppose to return no REcords.

suchitra1
Tera Contributor

Hi Team,

The reference Qualifier is working perfectly fine apart from the scenario like if the Owners doesn't have any records in that particular table,it should not suppose to return any value in the reference field but it showing all the records instead.The Script is working perfectly fine for those Owners who is having record in that Table,and as per the requirement it should not show any values to those Owners   in the reference field who doesn't have any records in the below mentioned table.

Here Is my Reference Qualifier and Script Include:

javascript:new AliasRefsort().alias(current.variables.Owner);

Script Include:

var AliasRefsort = Class.create();

AliasRefsort.prototype = {

  alias: function(Owner) {

var aliasref = '';

//var owner=current.variable_pool.Owner;

var tableowner = new GlideRecord('u_email_object');

  tableowner.addQuery('u_owner' , Owner);

  tableowner.query();

while(tableowner.next()){

    aliasref += 'sys_id=' + tableowner.sys_id + '^OR';

  gs.log(aliasref);

  }

return aliasref;

},

type: 'AliasRefsort'

};

Please assist...

1 ACCEPTED SOLUTION

Kalaiarasan Pus
Giga Sage

try this



var AliasRefsort = Class.create();



AliasRefsort.prototype = {


     


      alias: function(Owner) {


             


              var aliasref = [];


              var tableowner = new GlideRecord('u_email_object');


              tableowner.addQuery('u_owner' , Owner);


              tableowner.query();


             


              while(tableowner.next()){


                      aliasref.push(tableowner.sys_id.toString());


              }


             


              return 'sys_idIN'+aliasref.toString();


             


      },


     


      type: 'AliasRefsort'


     


};


View solution in original post

5 REPLIES 5

Harish Murikina
Tera Guru

Can you try this.



javascript:new AliasRefsort().alias(current.variables.Owner);



Script Include:



var AliasRefsort = Class.create();


AliasRefsort.prototype = {



  alias: function(Owner)


{




      var aliasref = '';




      var tableowner = new GlideRecord('u_email_object');


      tableowner.addQuery('u_owner' , Owner);


      tableowner.query();


      while(tableowner.next())


    {


              aliasref += tableowner.sys_id + '^OR';


              gs.log(aliasref);


  }


return 'sys_id='+aliasref;


}






};



Regards,


Harish.


Kalaiarasan Pus
Giga Sage

try this



var AliasRefsort = Class.create();



AliasRefsort.prototype = {


     


      alias: function(Owner) {


             


              var aliasref = [];


              var tableowner = new GlideRecord('u_email_object');


              tableowner.addQuery('u_owner' , Owner);


              tableowner.query();


             


              while(tableowner.next()){


                      aliasref.push(tableowner.sys_id.toString());


              }


             


              return 'sys_idIN'+aliasref.toString();


             


      },


     


      type: 'AliasRefsort'


     


};


Thanks a lot Kalaiarasan...I will mark it as correct.


Kalaiarasan P   I am trying to check another condition


javascript:new AliasRefsort().alias(current.variables.owner)+'u_type=Conference Room Mailbox'



i am able to call script include but unable to check both conditions together



Please check