简体   繁体   中英

How to create a custom table in Salesforce using Beatbox or simple-salesforce?

We are currently evaluating Python bindings for Salesforce - in particular Beatbox and simple-salesforce. In both modules via are missing functionality to create new custom tables, drop a custom table and dropping all items of a custom tables (without using individual deletes).

Of course we can create and model our own custom tables in Salesforce through the web but for the sake of automation and testability we would prefer to create our tables automatically using Python...any pointer on this issue and the mass deletion issue?

Unfortunately, Beatbox and Simple-Salesforce are not designed for the creation or deletion of custom objects (tables).

Beatbox (SOAP API) and Simple-Salesforce(REST API) were created to work with the Salesforce SOAP and REST APIs to access Salesforce data. This allows you to create, update, or delete records of existing objects and query records of those objects (tables).

If you want to create new custom objects programmatically, that is do able through the Metadata API ( https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/ ). However, I have no yet found a tool as user friendly as Simple-Salesforce for creating Metadata deployments. The metadata, in general, is less friendly because you have to push the whole metadata package as a zip file. It is more cumbersome than simple querying or record creation.

I don't have a good solution for the mass delete. Is the issue that doing them individually is slow or uses up too many API calls in your instance? One possible solution is to have a an Apex Class or classes that that does all of the deletes. Then create a custom object that has a number of checkboxes. Set up a trigger to call the Apex Delete Classes when a record of the that object is updated and the checkboxes are populated true. Then you can call an object update from Python that will trigger mass deletes. It is hacky, but it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM