cancel
Showing results for 
Search instead for 
Did you mean: 

Salesforce bulk query and bulk delete

hksnap29
New Contributor

Hi,

I'm working on Salesforce objects that are related Person and Accounts. A person can have many accounts. I'm fetching the Accounts object with Person Id(Parent Id). This will return multiple records and I have to delete all these records before deleting the Person object. When I'm querying Salesforce using SOQL Snap with a parent Id, it returns each record at a time instead of a list. As the snaps are executing sequentially, my delete snap is deleting only one Account record and trying to delete the person which is returning a conflict as it has associated Accounts.

This is how I'm fetching Account object:

hksnap29_1-1713851555189.png

Response:

hksnap29_2-1713853114396.png

I have to delete all these Account records as bulk or through some loop and only after that I have to delete the Person. how to achieve this.

hksnap29_0-1713851484970.png

2 REPLIES 2

Aleksandar_A
Contributor III

Hello @hksnap29,

I would suggest trying with the following snap sequence:

AleksandarAngel_0-1713856658695.png

Once you get all of the Account IDs, you should be able to use Salesforce Bulk Delete, and the Join Snap with the following settings:

AleksandarAngel_1-1713856723082.png

 Will block the process until all of the Accounts are deleted, and will pass through the Parent ID from the second Copy Branch.

Try with this approach and let me know if this helps you!

Regards,

Aleksandar.

 

SpiroTaleski
Valued Contributor

@hksnap29 

You can go with the @Aleksandar_A 's approach, but you don't need to pull again from the Person object, as you will have the Person identifier as an output from the Join Snap. 

So, you need only to map Person Id to be a proper input for the Salesforce Delete Snap(Deletion of the Person).

BR,

Spiro Taleski