function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How do i create lead using .net webservice

Has any one tried this. I want to create Lead from webservice. Can you please help




You can go to

Go to Getting Started --> Introducing API --> Quick Start --> Sample 4: Walkthrough code.


Here you will find the steps and sample code to create the record from .NET (sample code for C# after sample Java Code)


If you still have any issues, you can post it.




Devendra NataniDevendra Natani

You will have to refer partner.wsdl in .Net aplication.  Then try the following code to create lead.



sObject[] records = new sObject[1];
sObject sObj = new sObject();
sObj.type = "lead";
System.Xml.XmlElement[] fieldElements =new System.Xml.XmlElement[3];
fieldElements[0] = GetNewXmlElement('lastName', 'test');
fieldElements[1] = GetNewXmlElement('firstname', 'test');
fieldElements[2] = GetNewXmlElement('company', 'test');
sObj.Any = fieldElements;
records[0] = sObj;
UpsertResult[] upsertResults = binding.upsert("id",  records);


private System.Xml.XmlElement GetNewXmlElement(string Name, string nodeValue)
            XmlDocument doc = new XmlDocument();
            XmlElement xmlel = doc.CreateElement(Name);
            xmlel.InnerText = nodeValue;
            return xmlel;









Could you please post the error message tht you are getting on upsert?