How to hide relationship types in relationship editor?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks 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
3 weeks 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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hey @Matthew_13
Thanks, that makes sense! I already have the BR and the script include, its just reference qualifier part of the puzzle I was missing 🙂
Should the reference qualifier be added to a dictionary entry for cmdb_rel_type or cmdb_rel_ci or does it have go somewhere else?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
The reference qualifier should be applied to the dictionary entry of the reference field you’re trying to restrict, not directly to cmdb_rel_type or cmdb_rel_ci as tables.
So in practice from my reference:
Identify the field on your form that references relationships or CIs (for example, a reference to cmdb_ci or cmdb_rel_ci)
Open the Dictionary entry for that field
Add your Reference qualifier there (either as a condition or an advanced/scripted qualifier)
A few clarifications that usually help:
cmdb_rel_type is typically used inside a qualifier to filter relationship types, not as the place where the qualifier lives
cmdb_rel_ci is the relationship table, but you only reference it if your field actually points to that table
The qualifier always lives on the field definition, because that’s what controls what the user can select
In short: put the qualifier on the reference field’s dictionary entry, and use cmdb_rel_ci / cmdb_rel_type only as part of the filtering logic if needed.
Hope that clears up the last piece 👍
@Kiran_25 Give a Thumbs up or Accepted Solution if you find Helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Kiran_25 - Please mark as Accepted Solution please. Thanks Kindly
