Hiding fields with a business rule

milesdpratt
Giga Contributor

Hi all,

 

I have a requirement to track time worked on incidents for our help desk agents only. I would like to hide the time worked field when the incident is not assigned to the help desk. A UI policy could easily do this, but then the time worked while adding notes and reassigning wont be saved.

 

Is there a way to hide a field in an "after" business rule?

11 REPLIES 11

Kalaiarasan Pus
Giga Sage

How about using a onchange script ? Business rule is a server side script and it can't hide the fields....



create a onchange script on assignment group if not already present and do something like



if(newValue == 'sys id of help desk assingment group')


{


g_form.setDisplay('time_worked',false);


}


else


{


g_form.setDisplay('time_worked',true);


}


one way you can (kind of) do this in a BR is with a display BR, you can pass into the client whether the current user can see the field or not, i.e.



if (!gs.hasRole('itil')){


g_scratchpad.canseefield = false;


}



then in the client


if (g_scratchpad.canseefield == false){


g_form.setDisplay('fieldname',false);


}



we use this a few times to define whether users can see or even write to certain fields depending on special conditions that ACLs won't help with (long story)