0

I'm trying to create custom field by tooling api, but i got the error when i invoked create method.

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:tooling.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <createResponse>
            <result>
                <errors>
                    <message>To create an entity, its full name must be set and its id must be empty</message>
                    <statusCode>FIELD_INTEGRITY_EXCEPTION</statusCode>
                </errors>
                <id xsi:nil="true"/>
                <success>false</success>
            </result>
        </createResponse>
    </soapenv:Body>
</soapenv:Envelope>

This is the request soap body:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <SOAP-ENV:Header>
        <m:SessionHeader xmlns:m="urn:tooling.soap.sforce.com">
            <m:sessionId></m:sessionId>
        </m:SessionHeader>
        <m:MetadataWarningsHeader xmlns:m="urn:tooling.soap.sforce.com">
            <m:ignoreSaveWarnings>true</m:ignoreSaveWarnings>
        </m:MetadataWarningsHeader>
        <m:AllOrNoneHeader xmlns:m="urn:tooling.soap.sforce.com">
            <m:allOrNone>true</m:allOrNone>
        </m:AllOrNoneHeader>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <m:create xmlns:m="urn:tooling.soap.sforce.com">
            <m:sObjects xsi:type="CustomField">
                <m:DeveloperName>test10__c</m:DeveloperName>
                <m:TableEnumOrId>01I28000000tUu3</m:TableEnumOrId>
                <m:Metadata>
                    <m:fullName>test10</m:fullName>
                    <m:label>test</m:label>
                    <m:required>false</m:required>
                    <m:unique>false</m:unique>
                    <m:externalId>false</m:externalId>
                    <m:trackHistory>false</m:trackHistory>
                    <m:type>Text</m:type>    
                    <m:length>200</m:length>
                </m:Metadata>
            </m:sObjects>
        </m:create>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

1 Answer 1

0

After several attempts, some params are not correct in soap body. Please check details below:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <SOAP-ENV:Header>
        <m:SessionHeader xmlns:m="urn:tooling.soap.sforce.com">
            <m:sessionId></m:sessionId>
        </m:SessionHeader>
        <m:MetadataWarningsHeader xmlns:m="urn:tooling.soap.sforce.com">
            <m:ignoreSaveWarnings>true</m:ignoreSaveWarnings>
        </m:MetadataWarningsHeader>
        <m:AllOrNoneHeader xmlns:m="urn:tooling.soap.sforce.com">
            <m:allOrNone>true</m:allOrNone>
        </m:AllOrNoneHeader>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <m:create xmlns:m="urn:tooling.soap.sforce.com">
            <m:sObjects xsi:type="CustomField">
                <m:fullName>Campsite__c.test11__c</m:fullName>
                <m:Metadata>
                    <m:label>test11</m:label>
                    <m:required>false</m:required>
                    <m:unique>false</m:unique>
                    <m:externalId>false</m:externalId>
                    <m:trackHistory>false</m:trackHistory>
                    <m:type>Text</m:type>    
                    <m:length>200</m:length>
                </m:Metadata>
            </m:sObjects>
        </m:create>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
1
  • Might be nice if you provided some color commentary as to what you learned so the next person doesn't have to do a 'diff' between OP and answer. Glad you sorted it though!
    – cropredy
    Commented Nov 29, 2015 at 6:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .