Deleting oldest duplicate CI relationship via enrichment rule

Hi,

As part of data cleanup and consistency, we need to write an enrichment rule to ensure two CIs have only 1 single relationship between them and the existing old relationship should be deleted.

As of now, some Node CIs have more than one relationship with the Asset CI type via the 'Connection' relationship

ie.. Asset   <cardinality 2 - * >  to  ->  Node     returning result.

Though it is easy to write query to identify such CIs but struggling to write an enrichment rule where it can delete all but 1 relationship based on the 'create time'

So, if there are more than 2 relationship between Asset and Node, the oldest relationships should be deleted.

Please could someone assist a way of achieving the intended outcome.

Thanks

Shishir.

  • Suggested Answer

    0  

    Shishir;

    You could do this with a jython adapter that takes that tql as input, compares the times of the link creation and then deletes the oldest one.  You could also do this with the REST API, creating a 'on-the-fly-TQL' and getting the results, then removing the CI you want to remove.

    -- Hope this helps!

    Keith Paschal

    UCMDB Worldwide Support Lead