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

雨燕双飞 提交于 2020-01-04 07:50:10

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/34083300/how-to-create-a-custom-table-in-salesforce-using-beatbox-or-simple-salesforce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!