Before Query business rule not working

Lakshmi53
Tera Contributor

below script i written in before query business rule. but it's not working as expected. whole table data not able to view.

 

in details system property i have 2 records sys_id. i need to view those only once i open table but table shoing with empty record

 

(function executeRule(current, previous /*null when async*/ ) {

    current.addQuery("u_type", "!=", "info").addOrCondition('u_type', gs.getProperty('details'));
   
})(current, previous);
5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@Lakshmi53 

1 thing I wanted to check, is u_type a reference field?

If yes then you need to update as this

(function executeRule(current, previous /*null when async*/ ) {

current.addQuery("u_type", "!=", "infoRecordSysId").addOrCondition('u_type', 'IN' ,gs.getProperty('details'));

})(current, previous);

If it's string type then ensure system property holds not sysId but the actual name

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