hide form fields based on groups


I need to hide some personal information fields from a form, let’s say “formA”. In other words, some user can see those fields some others can not. I am going to do this way:

i will duplicate “formA” and call the duplicate “formA_nopersonal”. Then in this copy i will hide the fields i need to hide. Then i will link both the forms in the same menu that will be the top menu of my project.

i will assign user1 the right to see “formA” but not “formA_nopersonal” because he can see every field. Then i will assign user2 the right ti see “formA_nopersonal” but not “formA”. This should prevent that the user1 and user2 see duplicate items in the menu. is it right or they will see menu items ttwice? (one for the formA and the other one for formA_nopersonal)?

there is a more proper way to achieve this goal?


It should be easier to maintain if you keep one form only. You can hide/show fields conditionally using SC macros.


Which one is the right macro to be used for this purpouse?


Even easier if you group all fields you want to hide in a block:

Ok great… so how do I check what group a user is in so I can hide the block based on the entire group?

Answering my own question… Look it up in the security database.

Hello, yourguide. What do you mean? If the group not allowed to see field 1 is named "group1"the syntax is this?

if ({what_should_i_write_here} == “group1”)
sc_field_display({field1}, off);
sc_field_display({field1}, on);


I agree that the single form is easier. What I usually do is create a global variable in the log in app in the onValidate event. When you load the form app, you can check what group the user is in, and hide the fields that are not appropriate for that group. You can do it field by field, but as mentioned above, if you can put them all in a block, then you can just hide or show that block. I typically end up doing it field by field, as the show/hide fields tend to be scattered throughout the form.

You can do a variety of macros, depending on your desired outcome. For example:

if ( [global_group_member] == 4 )
sc_field_readonly({Field_01}, ‘on’);
sc_field_display({Field_02}, ‘off’);

I have not yet applied the Security module. I suppose
Global_Group_member is set by tbe Security module itself in One of the many tables it creates when you apply it.


No, that is not set by default. You have to do a lookup on the security groups table, then assign it to a global. I do that in the onValidate event in the log in app.

woudn’t it be better to put this macro in the onload event of the form that has the fields to hide?. if i have many applications and i have to hide fields in let’s say “form1”.
if i put that macro in the log in app, will those fields remain hidden even if i jump from one app to another and come back on the “form1”?

Thanks again

Sorry for the misunderstanding. You add the macro to hide fields in the form app. I mentioned that I create the global variable in the log in app. “create a global variable in the log in app in the onValidate event.”. You will want to control the form fields within the form itself. However, you can look to the global variable to see what group the user is in, which was created in the log in app.


if ([usr_priv_admin] == ‘Y’)
sc_field_display({partnerkod}, on);
sc_field_display({partnerkod}, off);

Its work fine !