I am using MetaData API to create the custom object and custom field, but problem is how to insert the data into that Custom object ( Entity ) ,,eg I have created one Custom object Employee and there are some fields in this object like name, address, phone and Email,, but problem is I have to update the Enterprise WSDL than only I got this
Employee objEmployee = new Employee();
I dont have liberty to update the WSDL everytime because my customer can make number of custom objects at runtime with custom fields. Someone told me that use the Partner WSDL but how still I am not getting the class of Custom object.......
Please help with the code I am new with SalesForce,, like how to create the custom object and custom field,, than insert data inot that object at runtime,,,,
I tried lots of things but no help!!!
This is my code
WalkThrough.Partner.sObject myobj = new WalkThrough.Partner.sObject(); System.Xml.XmlElement objFields = new System.Xml.XmlElement; // Create the contact's fields System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); objFields  = doc.CreateElement("label"); objFields .InnerText = "EmployeePartner"; objFields  = doc.CreateElement("pluralLabel"); objFields .InnerText = "EmployeePartners"; myobj.type = "Employeepartner__c"; myobj.Any = objFields ; // Add this sObject to an array WalkThrough.Partner.sObject objList = new WalkThrough.Partner.sObject; objList  = myobj; // Make a create call and pass it the array of sObjects WalkThrough.Partner.SaveResult results = binding.create(objList );
But its throwing exception
INVALID_TYPE: sObject type 'Employeepartner__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names