- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2015 10:00 AM
When hiding a value in the incident state dropdown for certain roles, is it possible to do this with a server-side script? I am aware you can use the "onLoad" functionality of client-side scripting.
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2015 11:02 AM
Hi Greg,
I successfully accomplished this via ACLs. For some reason, it wouldn't let me create a before query Business Rule on the sys_choice table and I didn't dig any further than that. Here is what I did:
1. Enable high security
2. Navigate to System Definition > Choice Lists
3. Open the sys_choice READ ACL with the description "open up choice rows to everyone to allow everyone to read label field".
4. Add a script to it similar to:
answer = true;
// If has role and the choice is closed (value = 7)
if (gs.hasRole('role here') && current.value == 7 && current.name == 'incident' && current.element == 'state') {
answer = false;
}
Admin users and those with the role to personalize choices will still see closed due to the admin override and the other READ ACL that is role based. So impersonate an appropriate user to test. Good to know this will work.
Edit: Modified the condition in the script to account for the table and field the choice applies to, in this case the state field on the incident table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2015 10:14 AM
Hi Greg,
You may be able to handle this using ACL's on the sys_choice table or possibly using a display Business Rule on the sys_choice table. I have personally not tried this approach but it seems like it should work. You would just need to script it using a gs.hasRole test.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2015 10:19 AM
i suspect you could do it in a view BR but haven't tried that.. what are you trying to accomplish?? why server side instead of using an onload client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2015 10:27 AM
For incidents, the state dropdown has a "closed" option which we would like to hide from certain roles. We are trying to avoid client scripts changing the form when the user has loaded the page. When the client scripts are executed using a UI Script, the screen flashes and the end users see the form with all the hidden choices and fields for a second or two. This happens because the changes to the form are made once the page loads and not beforehand.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2015 10:36 AM
I don't think you are going to be able to do this... the remove options is part of g_form method which only works in a client side script... so don't believe you are going to get it to execute as part of a BR.