function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SwamplanderSwamplander 

Deleting Leads & Contacts w/o creating Cases

When deleting a LEAD or a CONTACT using the REST API, Salesforce is blocking the action because it says the object is tied to an existing case. Sure enough, when I went to delete the object it created a case. The only way to fix this is to close the case and then delete it. Is it possible to have the delete happen without creating a case (maybe a setting or a special header / parameter)? I can't seem to find a way to either (1) bock the case from being created or (2) force the case to be created, close it, then delete the record. Reason being that the case seems to be created automatically when I try to delete and thus, the delete fails with no hint as to the case created when looking at the raw JSON response.

 

This is part of a utility I have that purges my leads & contacts in my SF dev instance, creates a bunch of sample data & then runs automated tests against a process that utilizes the REST API. RIght now it seems a lot easier to manually log into the dev instance, run a mass delete against all leads & contacts and then run the import routine... however this isn't really an automated test (something I'd like to run nightly).

SwamplanderSwamplander

Without fail, you get your answer not 2s after posting a question you've been fighting with for a few hours.

 

Nevermind... the cases were coming from the default data in my dev instance. Deletes are now working great...