You need to sign in to do that
Don't have an account?
Get Lead ID of Lead created using API
Is there a way to retrieve the ID of the lead created using the API?
Lead l = new Lead(); l.FirstName = fname.Text; l.LastName = lname.Text; l.Phone = phone.Text; l.Email = email.Text; l.Title = title.Text; l.Company = company.Text; l.State = state.SelectedValue; l.Country = country.SelectedValue; l.LeadSource = "Web"; SforceService sfdc = new SforceService(); string usr = "xxxxxxx"; string pwd = "xxxxxxx"; LoginResult lr = sfdc.login(usr, pwd); sfdc.Url = lr.serverUrl; sfdc.SessionHeaderValue = new sforce.SessionHeader(); sfdc.SessionHeaderValue.sessionId = lr.sessionId; sforce.GetUserInfoResult userInfo = lr.userInfo; sObject[] records = new sObject[] { l }; SaveResult[] sr = sfdc.create(records); if (sr[0].success) { // Try to get the ID of the lead just created }