Ui policy to not run when user has specific role

Khalnayak
Tera Guru

hi guys,

I have a UI policy which makes the PIR fields in a change form read-only.

However I don't want this UI policy to run if the user has role  change_manager.

How can I put this in the UI policy script to take affect please?

1 ACCEPTED SOLUTION

Michael Jones -
Giga Sage

You could also modify your UI Policy and, instead of using an action to set the fields read only, use the run scripts option and in your script for true, use something like this. 

function onCondition() {

if(!g_user.hasRoleExactly('change_manager')) {
	g_form.setReadOnly('<name_of_field>', true);
}

}

That would get the job done as well. 

I hope this helps!

If this was helpful or correct, please be kind and remember to click appropriately!

Michael Jones - Proud member of the CloudPires team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

View solution in original post

9 REPLIES 9

Michael Jones -
Giga Sage

Is there a particular reason you are using a UI Policy to accomplish this and not an ACL?

If you created a read ACL on those fields and assigned the role change_manager, they would be read-only for anyone who does not have the change_manager role in all instances (including the list view, etc.)

Depending on your overall requirements that might be the best solution. 

I hope this helps!

If this was helpful or correct, please be kind and remember to click appropriately!

Michael Jones - Proud member of the CloudPires team!

 

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

In the second sentence, I guess you meant write ACL, not read ACL.

Hi Michael,

I need them fields visible to other users, i only want the fields to be read-only for them once the change has been closed, but still want it editable for change_manager

Yes, I meant to say "write" ACLs - that would stop anyone but the change_manager from modifying the fields. 

I hope this helps!

If this was helpful or correct, please be kind and remember to click appropriately!

Michael Jones - Proud member of the CloudPires team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!