How to Visible Field based on user role (LIKE : change _manager) on change request ?

ram_sn2018
Kilo Contributor

How to Visible Field based on user role (LIKE : change _manager) on change request ?

Scenario : When ever Change manger group members login  that time only one more extra  field (Like : Author side ) field visible. Please help me ....

 

Thanks,

Ram

1 ACCEPTED SOLUTION

It's really quite messy to use a UI policy here I would recommend an onLoad client script or an ACL.

 

However if you simply must have a UI policy then you can create one with a condition that is always true

like number is not empty

reverse if false is off

run scripts true

Execute is true script

function onCondition() {
var hasRole = g_user.hasRole('change_manager');
if (hasRole ==true) {
g_form.setVisible('u_ram', true);
} else{
g_form.setVisible('u_ram', false);
}
}

 

I have tried this in a dev instance and it's fine but you are really better off using an ACL or client script

View solution in original post

11 REPLIES 11

Allen Andreas
Administrator
Administrator

If that group has a role associated to it and you want to limit this field to be visible by only them, then the most secure way is by ACL (which means you'd need to create a READ ACL for that table and that field, specifically) However...if you don't want to go that route, then you can do a UI Policy, with no conditions, and go to script section (set it to ALL UI type) and put this in the script area:

if (g_user.hasRole('change_manager')) {
g_form.setDisplay('u_field_name', true);
} else {
g_form.setDisplay('u_field_name', false);
}

You could also use an onLoad client script with the same script above.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi,

I just wanted to check in and see if you needed any other assistance.

If your issue has been resolved, if you don't mind, please mark my post as Helpful/Correct.

Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Thanks for your response ,,

Not resolved my issues , we need through UI Policy, 

 

Please help me ......

 

Thanks,

Ram

It's really quite messy to use a UI policy here I would recommend an onLoad client script or an ACL.

 

However if you simply must have a UI policy then you can create one with a condition that is always true

like number is not empty

reverse if false is off

run scripts true

Execute is true script

function onCondition() {
var hasRole = g_user.hasRole('change_manager');
if (hasRole ==true) {
g_form.setVisible('u_ram', true);
} else{
g_form.setVisible('u_ram', false);
}
}

 

I have tried this in a dev instance and it's fine but you are really better off using an ACL or client script

Thanks...

Its working fine, resolved my issue.

 

Thank,

Ram