The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to modify a query for a related list with a onBefore business rule?

Lupita
Tera Contributor

Hello

I have a requirement to omit certain records on a related list by user role, I mean if user is not an admin then some SLAs records should not be available for them but if user is admin then all SLAs related to ticket should be listed down. Could you please help?

Thanks

1 ACCEPTED SOLUTION
5 REPLIES 5

santoshsahoonis
Kilo Guru

Dominik Simunek
Tera Guru

If you want to hide them only in special related list, you can create your custom relationship and add it to related lists on the form - Create defined related lists



Find it in System Definition > Relationships module.



If it should be global, use ACLs and before query BRs.


Harish KM
Kilo Patron
Kilo Patron

you need to use before query business rule.


Regards
Harish

Alikutty A
Tera Sage

Hi,



How will define the certain records, is it based on any field?



You can add a query business rule with this code



if (!gs.hasRole("sla_admin") && gs.isInteractive()) {


  var qc = current.addQuery("field_name", "value");   // If user is not admin then display only those records that have a value set


}




Thanks


PS: Hit like, Helpful or Correct depending on the impact of the response