5

I was looking through the Metadata API (and Partner) but can't find anywhere described how I can define via the API a custom object.

We have specific datasets which have to translate into Custom Objects in Salesforce via the API.

For instance a Home Repair dataset would include: Address, Estimate and Repair Date fields. I want to translate this dataset into a Custom Object (named HomeRepair__c with those 3 custom fields) in Salesforce in our client's account via an API call.

Is this even possible?

Thanks.

10

Sure, you can use the Metadata API. You want the create() call. Here's the sample xml to define the custom object from the documentation:

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <deploymentStatus>Deployed</deploymentStatus>
    <description>just a test object with one field for eclipse ide testing</description>
    <fields>
        <fullName>Comments__c</fullName>
        <description>add your comments about this object here</description>
        <inlineHelpText>This field contains comments made about this object</inlineHelpText>
        <label>Comments</label>
        <length>32000</length>
        <type>LongTextArea</type>
        <visibleLines>30</visibleLines>
    </fields>
    <label>MyFirstObject</label>
    <nameField>
        <label>MyFirstObject Name</label>
        <type>Text</type>
    </nameField>
    <pluralLabel>MyFirstObjects</pluralLabel>
    <sharingModel>ReadWrite</sharingModel>
</CustomObject>
  • Could you explain how to use this? – auny Jun 6 '15 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.