The CreatorCon Call for Content is officially open! Get started here.

Hide records with before query business rule

llarmeu
Mega Contributor

I've created an application that only a small group of users can see. The app requestor would like the general team to be able to view most of the records, but would like the ability to create "confidential" records when needed, which would only be viewable to the app admin, the opened by user, and the assigned to user.   To accomplish this, I created a checkbox called "Confidential." Now, I'm trying to write a before query business rule to hide records IF the confidential condition is set to true, unless the user is the opened by or assigned to.

Am I even going down the right path? Any help is appreciated.

1 ACCEPTED SOLUTION

Stephen W_
Giga Guru

This should really be handled as an ACL, You can either specify this in the ACL condition, or configure it in the ACL script.


View solution in original post

3 REPLIES 3

Anurag Tripathi
Mega Patron
Mega Patron

hi Larry,



I think you are on the right track, make this modification



function onBefore(current, previous) {


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


    var u = gs.getUserID();


    var isconfidential = current.addQuery("u_confidential");


  if (isconfidential) {


    var qc = current.addQuery("opened_by", u);


      qc.addOrCondition("assigned_to", u);


  }


}


}


-Anurag

Stephen W_
Giga Guru

This should really be handled as an ACL, You can either specify this in the ACL condition, or configure it in the ACL script.


Mrman
Tera Guru

Hi @llarmeu ,

Could you please let me know how the ACL has been created for the same . I have very similar requirement .