I need business rule to make read only role specific?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 04:20 AM
Is there a way I can make a field read only to specific roles?
So for example everyone with ITIL it will show as read only but overridden by admin?
Thanks
Andrew
- Labels:
-
Field Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 04:29 AM
If you want to make field read-only based on role either you can use UI Policy or Client Script but not sure why you are looking for a Business Rule? Is there any specific reason?
If you want to apply the role based condition in client script use g_user.hasRole("role_name").
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 04:39 AM
Hi, I don't necessarily want a business rule it was a generalization as I don't know how I go about it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 04:44 AM
you can use hasRole() / hasRoles()
eg:
if(!gs.hasRole('admin'){
//code
}
If you need to set a field to read only you'll need to use a client script so you'll have to use GlideAjax to call a script include and run the query there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 08:21 AM
David Dubuis,
Thanks again for helping out, at this rate I'm going to be skint buying you all these pints especially in London.
I need some further help... I'm not entirely sure how I should write it.
So the script needs to be something like,
if(gs.hasRole('ITIL')==true){g_form.setReadOnly (u_approved_hours, true)};
{
I'm still learning but getting there.. in short I need it to translate to,
If role is ITIL field readonly, field name is u_approved_hours
Thanks