
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2023 05:47 PM
I have a requirement to sync business app to mapped application service for the following fields owned_by and managed_by when the bus app owned_by and managed_by changes. I am assuming it needs to be cmbd ci relationship table but not sure. Any assistance is appreciated.
Thanks,
Chad
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 06:08 PM
Hi @Community Alums
On Which table this BR is written? Business Application or Relationship table.
It should be on business app table.
And add logs inside the if condition, so that we can be sure of the query returned results.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2023 06:26 PM
Hi @Community Alums
Yes you can use cmdb_rel_ci table. Query should be like parent is current.sys_id and type is Consumes::Consumed By and the child class should be like cmdb_ci_appl. Then update the data in the fetched applications. You can change these relation ship type and Child Class type as per your need. Some script like below you can use.
After - Update Business Rule:
(function executeRule(current, previous /*null when async*/) {
var relGr = new GlideRecord("cmdb_rel_ci");
relGr.addEncodedQuery("type=41008aa6ef32010098d5925495c0fb94^child.sys_class_name=cmdb_ci_appl^parent=" + current.getUniqueValue()); //Change Type and Child Class type as per your need
relGr.query();
while(relGr._next()){
var app = relGr.getValue('child');
var appGr = new GlideRecord("cmdb_ci_appl");
if(appGr.get("sys_id", app)){
appGr.owned_by = current.owned_by;
appGr.managed_by = current.managed_by;
appGr.update();
}
}
})(current, previous);
Please mark my answer helpful and accept as a solution if it helped 👍✔️
Anvesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 03:02 PM
Hello Anvesh,
I appreciate the assistance. I made the changes but it is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 06:08 PM
Hi @Community Alums
On Which table this BR is written? Business Application or Relationship table.
It should be on business app table.
And add logs inside the if condition, so that we can be sure of the query returned results.
Anvesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 04:46 PM
@AnveshKumar M Hello, any assistance is appreciated. Thanks, Chad