Deleting objects only if completely unrelated to other objects

Discussion created by Michael_Coxson_5769 on Mar 1, 2017
Latest reply on Mar 2, 2017 by Pete Wirfs
I am attempting to build a process that you feed a list of Objects to delete from a list of Clients that will then hunt for associations for all related Objects and delete them if they are only related to the "upper level" objects of the original list.  For instance, if I attempt to delete a Jobplan which contains three JOBS, one of which is called in a separate Jobplan and another that is called as a MRT event in another JOBS, it would only delete the specified Jobplan and the one internal JOBS unrelated to other objects.  This would allow us to clear old or requested removed objects safely without inadvertently impacting other processes and/or teams.

Has anyone else dealt with this?  If so, how did you go about it?  Currently I am working to code an Java API process that utilizes SQL calls for faster returns, which will eventually be called by a JOBS using a :READ to get object names and clients to target.  I have most of the queries pinned down and it's just a matter of finishing the code, but I'm curious if there's a simpler/more robust solution.