Making field read only for non admin users.

shubhamverm3478
Tera Contributor

Hi,

I want to make two fields read only for some non admin users on workspace form .

How can I achieve this with UI Policy.

6 REPLIES 6

Abhishek_Thakur
Mega Sage

Hello @shubhamverm3478 ,

You can use GlideUser API in UI Policy script.

var isadmin = g_user.hasRole('admin', true);

if(isadmin){
// Perform the action
}

 

Please mark my answer as accepted solution and give thumbs up, if it helps you.

shubhamverm3478
Tera Contributor

Can you specify application scope will be global or worksapce?

Also view if not global?

That will be automatically defined upon selection of the scope in which you are working.

Ehab Pilloor
Mega Sage

Hi @shubhamverm3478,

You can use this in UI Policy script:

 

if (g_user.hasRole('admin', false)){
 g_form.setVisible('ENTER YOUR FIELD 1 NAME', false);
 g_form.setVisible('ENTER YOUR FIELD 2 NAME', false);
}

 

If you found my response helpful, please mark it as Solution and Helpful.

 

Thanks and Regards,

Ehab