How to update a field on all related(upstream & downstream) CI records when field is updated

dhanu3
Kilo Sage

We have 1 custom field on cmdb_ci table which is used in all inherited tables, we want to update new field on all related records(business application, business service, application service, etc.). Records can be upstream as well as downstream. But when any upstream and downstream record is updated related records of those should also get updated. We cannot define till what level we can go. So how we can update it?

 

Regards,

Dhanashree

3 REPLIES 3

Mark Manders
Mega Patron

Be very careful with this, because if you are updating both ways, you are probably creating loops because it will trigger on the tables. On what table is the field going to be changed and on what condition? 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Hello Mark,

 

What user want is when the field is updated on any of the record like business service, business applications, application services, or any related CI class, then it should get updated on related upstream and downstream record as well.

So table can be any of the above mentioned tables, and field will be updated manually by user.

 

I would really challenge this requirement because of the limited information here, because, depending on the complexity of the CMDB, this can cause huge performance issues. Relationships can cross over into objects with other relationships, causing you to end up with the field just being the same everywhere. 

 

If it is absolutely necessary: create a flow that just checks on the direct relationship of the CI. Trigger it on change of the field. A lookup to the cmdb_rel_ci table where this CI is either parent or child and that field is not the same as on the triggered record, gives you the records it needs to update.

Those records will trigger the flow for the updated records and do a lookup to all related records where the field is not the same, so it will skip the record it came from. 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark