Need to limit visibility of UI action to record or role.

jmoss
Tera Contributor

Hi all,

I need some guidance on how to approach this requirement. 

The requestor wants a group of users to have access to set of records with a certain type of contract model.

They want the user to be only be able to edit these set of records, which I have achieved with a write ACL and a custom role.

However they also want them to be able to access the UI actions, which can be achieved by using 'required role' on the UI action.

They only wants these UI actions visible to the user with the custom role, on the records with the specified contract type. Due to the character limit on the condition field, I can't fit this condition on top of the existing OOB condition.

 

Can some provide a similar example of a script include which creates and checks whether the user has a custom role and the record field is a specific choice. I would also be interest in a different approach if any one has any ideas 🙂 thank you!

 

1 REPLY 1

Sandeep Rajput
Tera Patron
Tera Patron

@jmoss The script include approach is correct if you are running short of characters in the condition string field.

 

You can check something like the following in either the condition string or inside your script include.

 

 

current.state == 18 && new hr_Delegation().isAssignedOrDelegated(current)

 

Here inside the hr_Delegation script include, the definition if isAssignedOrDelegated method lies, the current object is a glide record of the current record shown on the form and you can check the role using gs.hasRole('<role_name>'); to check if the user has the custom role or not on the basis of the evaluation you can return true/false from the script include method to show/hide the UI Action.