onLoad Client script to hide dropdown values for a field not running fast enough
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 11:08 AM
Hello,
I have a client script that checks for the following items...
1. does the user have a certain role
2. is the ticket assigned to the appropriate group (assignment group = )
3. If the ticket is approved
if( approvalValue == "approved" && g_user.hasRole('group_name') && assignmentGroupValue == "groupname") {
}
based on this i perform a lot of g_form.removeOptions for a state field that is a dropdown.
However when clicking on the record i can quickly click on the state field and see all the choices before this script can process and even select ones that should be hidden/removed. After the client script runs to completion then these dropdown options are removed but there is this lag where all options will be present before the script runs.
Is there any way to improve the performance of this script or is client scripting not the appropriate method?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 11:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 12:14 PM
Ok this should solve my problem where i dont want people quickly choosing choices that shouldnt be available...
But unfortunately i have a new problem..
when i add a choice like so..
g_form.addOption('state', '97', 'Development Ready');
and i can choose and set the state
but when i save the record it switches back the display value to 97..dont know why this happens as it is the database value..