Business rule to change Parent::Child relationship type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2022 08:25 AM
Hi Experts,
I am manually converting business services to application service by UI action "Convert to Application Service" button. After I click that button it creates a record in Calculated Application Service table then I am using relationship editor(+) to modify the parent child relationship. Like, if there is any "Contains::Contained by" relationship then I would use suggested relationship and select Consumed by(child) and in the filter put the name of the parent and add the relationship and then delete the "Contains::Contained by" relationship.
I am wondering if I can achieve the same using after or async Business rule when the record is inserted into Calculated Application Service table.
I am unable to figure out how would I change the type of relationship using script.
Could anyone please let me know if this is possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2022 02:15 PM
I think that if you go to the CI Class Manager you can change the relationship types for an entire table from there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2022 10:14 PM
Hey Harun,
I have written after insert business rule on cmdb_ci_service_calculated table.
var rel = new GlideRecord('cmdb_rel_ci');
rel.addQuery('child', current.sys_id);
rel.query();
if(rel.next())
{
rel.type = 'sys_id' //sys_id of the Consumes::Consumed by from cmdb_rel_type table
rel.update();
}
But its not updating the relationship. If you could help me in this regard? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 04:13 AM
Did you debug if its going in the if block?