AnsweredAssumed Answered

use hook to show/hide fields

Question asked by Bernhard Leitgeb on Mar 2, 2017
Latest reply on Mar 2, 2017 by Brad Foster

Hello Dear sugar community!

 

I have this code:

 

 

function after_retrieve($bean, $event, $arguments) {
global $current_user;
   if($current_user->id == 1) {
      //here I want to set any field within $bean visible
   } else {
      //here I want to set any field within $bean invisible
    }
}

 

 

If my current user id is 1 (admin) I want to show / hide any field within $bean. How can I modify the field property with the hook? I know it can be done with a view or sugar formula but i need it with a hook.

 

Thank you!

Outcomes