You need to sign in to do that
Don't have an account?

Difficulty with Metadata API -
Hi,
I am having difficulty with attempting to create a new custom object. I have a valid connection etc. (In this case to a sandbox).
The login credentials have sysadmin rights.
The error I get is "Unable to determine type mapping for type CustomObject. Type is illegal here."
I have no idea what the issue is.
I have posted the SOAP request below (header removed).
<?xml version="1.0" encoding="utf-8"?> <SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header> {Header removed} </SOAP-ENV:Header> <SOAP-ENV:Body xmlns="http://tempuri.org/"> <create xmlns="http://soap.sforce.com/2006/04/metadata"> <metadata xsi:type="ns1:CustomObject"> <fullName>MYOB__c</fullName> <customSettingsType>List</customSettingsType> <deploymentStatus>Deployed</deploymentStatus> <description>This is a test Object created using the Metadata API.</description> <enableActivities>true</enableActivities> <fields> <fullName>MyField__c</fullName> <description>This is a description of a custom field.</description> <formulaTreatBlanksAs>BlankAsBlank</formulaTreatBlanksAs> <label>My Custom Field</label> <maskChar>asterisk</maskChar> <maskType>all</maskType> <picklist> <sorted>false</sorted> </picklist> <summaryOperation>count</summaryOperation> <type>Text</type> </fields> <gender>Neuter</gender> <label>Mind Your Own Business</label> <nameField> <formulaTreatBlanksAs>BlankAsBlank</formulaTreatBlanksAs> <maskChar>asterisk</maskChar> <maskType>all</maskType> <picklist> <sorted>false</sorted> </picklist> <summaryOperation>count</summaryOperation> <type>AutoNumber</type> </nameField> <pluralLabel>Mind Your Own Businesses</pluralLabel> <searchLayouts /> <sharingModel>ReadWrite</sharingModel> <startsWith>Consonant</startsWith> </metadata> </create> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Any help is appreciated.
All Answers
I had the same problem with just trying to add a Custom Field...
Unable to determine type mapping for type CustomField. Type is illegal here.
Can someone please post a properly formed SOAP Request (or at least the XML) for the creation of a CustomObject? I don't quite trust the MetadatAPI manual - manual the example XML given does not include any reference to the fullName property so it cannot be right.
I am getting a valid session via both the Enterprise WSDL and the Partner WSDL and using the LoginResult.metadataServerURL to get the URL for the metadata interface.
These are, respectively,
URL:: https://cs2-api.salesforce.com/services/Soap/c/16.0/00DR0000000DkyR/0DFR00000004FaC
MetadataURL: https://cs2-api.salesforce.com/services/Soap/m/16.0/00DR0000000DkyR
(This is a sandbox).
Thank you Simon.
I misinterpreted the error message and was barking up the wrong tree.
Very much appreciated.
Hello Fellas,
Thanks for posting this information - it has definitely helped me out.
May I ask - is this possible to be done from within a trigger? That is, can I actually access the Metadata API via trigger to create a field in an object?
Thanks
is there any way to edit picklist value through metadat API .
I am current testing meta data API via SOAP ui and till now I am able to add picklist values .
but can not edit any perticuler picklist value
eg . object : lead
field : number__c
type : picklist
values : 1 , 2
any methode i can edit 1 to 11 ??