Auto-Populate a reference field of parent table with the name of the Child
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Team,
Can you please guide me regarding the After Business Rule to Auto populate a custom field named as"Physical Host Name" on a Parent Server record with the Child name once a CI Relationship is created.
Below is my sample script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
the screenshot is terrible quality, please when asking for help provide a readable one...
I cannot evaluate the trigger myself, but what you can do is TEMPORARILY change the condition to just one condition, e.g. "Parent class" [IS] "Server", then try to trigger it.
BTW what is the operator "IS A"?
✂-----Cutting-out-the---✦AI-noise✦---All-replies-written-and-vouched-for-by-GlideFather---
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Chandrika4 you can also try to change it from "IS A" to "IS":
✂-----Cutting-out-the---✦AI-noise✦---All-replies-written-and-vouched-for-by-GlideFather---
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
try to keep just one single condition or not at all, to make it more trigerrable or check the script in a background script, have you logged it to see if it is triggered?
✂-----Cutting-out-the---✦AI-noise✦---All-replies-written-and-vouched-for-by-GlideFather---
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Chandrika4 ,
The issue is with how the parent CI is being retrieved. Since this Business Rule is on cmdb_rel_ci, you should get the parent using current.parent.getRefRecord() rather than current.getRecordClassName().
Also, since u_physical_host_name is a reference field, assign the child CI’s sys_id/reference, not its name.
(function executeRule(current, previous) {
var parentCI = current.parent.getRefRecord();
if (parentCI.isValidRecord() && !parentCI.u_physical_host_name) {
parentCI.u_physical_host_name = current.child;
parentCI.update();
}
})(current, previous);Make sure the Business Rule is configured on cmdb_rel_ci with After → Insert and temporarily remove any condition while testing. If the BR still doesn’t trigger, check that the CI relationship is actually being created on cmdb_rel_ci.