0

Just like upsert, I want to bulk delete records of a particular custom index using beatbox. Is there any way?

I am getting MALFORMED_ID when i am doing it.

Gagan
  • 1,775
  • 5
  • 31
  • 59
  • I just now noticed that when you delete using beatbox, it by default deletes it from Accounts which is not expected. Please if someone comes to this page, dont try to use delete option. FInally I am undeleting accounts from the recycle bin. :( – Gagan Apr 26 '17 at 05:10
  • This could be an interesting question and I can answer if you write more information, maybe also the beatbox source (PyPI or Github?) and how approximately you deleted anything by mistake. (experimenting with demo or by your code?) I think beatbox is safe. (Similarly your question [Beatbox upsert not...](https://stackoverflow.com/q/43740127/448474) requires more information or edit.) – hynekcer Aug 06 '17 at 15:17

1 Answers1

1

Delete command in beatbox depends on delete() SOAP API call. It requires to know primary keys Id of deleted objects and there is no possibility to use external ID, because it should be known beforehand exactly what is deleted. (example for Contact object)

sql = "SELECT Id FROM Contact WHERE my_external_id__c in ({})".format(
    ', '.join("'{}'".format(x) for x in external_ids)
)
svc.delete([x['Id'] for x in soap.query(sql)])

You can see in the docs nearby that update() and upsert() calls support external IDs.

hynekcer
  • 14,942
  • 6
  • 61
  • 99