Confidential business rule

RobertPC
Tera Contributor

I created a before business rule that hides fields when a ticket it assigned to a specific group

 

Condition - !gs.getUser().isMemberOf('<group name>')

 

(function executeRule(current, previous /*null when async*/ ) {
var grp = current.addNullQuery('assignment_group').addOrCondition('assignment_group','!=','<group name>');
})(current, previous);

 

It does hide the short description, description, and notes as expected. The problem is it hides them from everyone, how do I reverse the rule so it is not hidden when assigned to the appropriate group?

4 REPLIES 4

Anand Kumar P
Tera Patron

Hi @RobertPC ,
Use below script,

(function executeRule(current, previous /*null when async*/ ) {
    if (current.assignment_group != groupNamesysid) {
        current.setDisplayValue('short_description', false);
        current.setDisplayValue('description', false);
        current.setDisplayValue('comments', false);
    }
})(current, previous);

Please mark it as helpful and solution proposed if it serves your purpose.

Thanks,

Anand 

Anurag Tripathi
Mega Patron

Hi Robert,

That is in your condition, isn't it

Condition - current.assignment_group == '<Group>'  

Script

(function executeRule(current, previous /*null when async*/ ) {
if(!gs.getUser().isMemberOf('<group name>')) // this is the group that should see it
{
var grp = current.addNullQuery('assignment_group').addOrCondition('assignment_group','!=','<group name>');
}
})(current, previous);

 

-Anurag

Madankumar N1
Tera Contributor

Do you want hide field s on form or don't want show particular records for a group

If you want to hide fields on form try with UI policy or Client script
if you want dont show particular records then try query business rule