How to hide relationship types in relationship editor?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I have a system property which contains a list of sysIDs for relationships that are on the cmdb_rel_type table and i want to use this to prevent users from being able to select certain relationships if criteria is met. I've create a script include which reads the sys property which reads the property but the relationship shouldn't be visible to the user in the relationship editor, which is what i am having trouble with.
EG
If the business application = application family 'Parent' then the users shouldnt be able to select a 'critically dependant on::critically used by' relationship.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi Kiran - Nice to meet you!
The issue is where the logic is applied.
A Script Include by itself can’t hide relationship types in the Relationship Editor. The editor only respects UI-level filtering, so even though your Script Include reads the system property correctly, it won’t affect what the user sees.
Correct OOTB approach
To prevent users from selecting certain relationships, you need to filter cmdb_rel_type at the UI level using a Reference Qualifier.
Best practice:
Use an Advanced Reference Qualifier on the relationship type field
Call your Script Include from the qualifier
Have the Script Include:
Read the system property (list of disallowed sys_ids)
Check the CI context (e.g. Application Family = Parent)
Return an encoded query like sys_id NOT IN <property list>
This will make the relationship not visible in the Relationship Editor.
Recommendation
Also add a server-side validation (e.g. Business Rule) to block API/import updates.
Summary: Script Include alone won’t work use a reference qualifier to hide the relationship types.
*Please thumbs up as Helpful as well as Solution Accepted if you find helpful!