We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Before Query Business Rule is not working

Rajamouly
Tera Expert

HI,

 

I am trying to restrict the incident records, when the user is tick on the check box  'Visible to HRIS team' and should be part of any of two assignment groups  "HRIS - Workday Support"  and "HRIS - iCIMS Support" .

 

Below is the Business Rule Written but it is not working.

 

(function executeRule(current, previous /*null when async*/) {
 visible= current.u_visible_to_hris_team;
  if(visible=='true'){  
    if(gs.getUser().isMemberOf('HRIS - Workday Support')) {
current.addQuery('assignment_group.name','HRIS - Workday Support');
}
    else if (gs.getUser().isMemberOf('HRIS - iCIMS Support')){
current.addQuery('assignment_group.name','HRIS - iCIMS Support');
}
}   
})(current, previous);
 
Note: The Business Rule is working if we remove the Check box condition "if(visible=='true')" ,  Please help me how should it make it work for Check box True condition.
11 REPLIES 11

@Amit Gujarathi 

you cannot access field value inside Query Business rule

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

Rajamouly
Tera Expert

HI,

 

Can any one help me how to acheive the requirement.