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
SQureshiSQureshi 

How to Insert Contact to Salesforce from ASP .NET Page

I want to insert contact to salesforce, I'm using developer.force account. How can I insert contact? I can't use upsert() method because I"m unable to specify External Id field. Can I create External Id field for connected application using developer account?
jnhimanshu10001.3940903706790896E12jnhimanshu10001.3940903706790896E12
Please check the method to create a contact in a simplest manner. For specfiing the accountID you can query SOQL to fint the accountID from account table.

Contact con = new Contact();
            con.FirstName = "********";
            con.LastName = "********";            
            con.AccountId = "********";
            con.Phone = "********";
            con.Email = "********@gmail.com";
            SaveResult[] sr = binding.create(new sObject[] { con });
            foreach (SaveResult s in sr)
            {
                if (s.success)
                {
                    Console.WriteLine("Successfully created Lead with ID: {0}", s.id);
                }
                else
                {
                    Console.WriteLine("Error creating Lead: {0}", s.errors[0].message);
                }
            }