Restrict choices of a field to be visible on a child.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2022 10:46 PM
Hi experts,
I have a requirement where we have a field say Type on a cmdb_ci table. This field is meant to have different choices for different classes. FOr example, for class cmdb_ci_server it has 3 choices-
1. Server 1
2. Server 2
3. Server 3
Class cmdb_Ci_linux_server should have choices
1. Linux server 1
2. Linux server 2
which works fine, as Linux has defined its own choices on Type field the choices from the parent - cmdb_ci_server will not be available.
But now, for the class cmdb_ci_aix_Server, there are no choices needed as per requirement, but the choices from the cmdb_Ci_linux_server are inherited as Linux is the parent for AIX server.
The option of - Configure choices works well on choices inherited from Task to Incidents but when I tried it in above scenario, it does not work.
Is it possible to restrict this inheritance of choices for particular classes in any other way?
Thanks in advance!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 12:34 AM
Hi,
The workaround is to create an onLoad (and onChange) client script, using the g_form.removeOption() statement to remove the unwanted choices for the parent table.
NOTE: this workaround works for form view, but not for list views. The value will still show up for the dependent field in list view. To deal with that, add a 'list_edit' ACL on the substate field (to prevent updates) or a business rule that validates the value selected by the user when trying to save; aborting the transaction when the selected value is not eligible; Hiding the unwanted value from list view is not possible.
Mark this as Helpful/Correct, if Applicable.
Regards,
Sourabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 12:55 AM
Hi Sourabh,
Thanks for reply.
But as there are multiple child classes of CIs I cannot apply the client script for each of the classes. Also, as you mentioned it will not work on the list view.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 02:47 AM
In that case you should configure the choice separately on each child table instead of adding it on the parent and then hide.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 03:16 AM
The problem here is we do not want the choices at all on some of the child tables, in which case it inherits the choices from parents.