Deleting all existing associations - child companies

Hi Team,

Need any help to delete all the existing associations and override with the new mappings for one particular definitionId only.

ex: i want to add some child companies to one parent company, at the same time like to remove all existing child companies.
Existing solution: As of now, we can mention list of child companies using delete batch API to remove.

But i’m not bothered about what child companies associated to it, i just want to override with new list to that parent company.
Appreciate your suggestions.
Thank you !!

Hey, @MKoduri :waving_hand: Thanks for your post. I hope you were able to make progress.

You are not missing a way to accomplish this in a single call. You’ll need to query a company and get all the associations by type. Then delete the associations and add the new/updated one using a batch endpoint.

Something similar to:

  • Retrieve Current Child Companies: Get the list of current child company associations for the parent
  • Delete Existing Associations: Use the batch delete API call with the IDs of the existing child companies
  • Create New Associations: With the batch create API, associate the new list of child companies to the parent

Best,

Jaycee