You need to sign in to do that
Don't have an account?
API - Problem updating Lead Objects
I am currently using VB to update some custom Leads Fields in my Salesforce Organization.The lead, at this point, has already been created in the organization. So I am only updating the custom fields below.
But when upsert is called, I receive the following error:
SalesforceManager : BuildSalesforceErrorMessage() : Salesforce Object - Lead : Salesforce Status Code : INVALID_FIELD_FOR_INSERT_UPDATE : Unable to create/update fields: IsConverted, LastModifiedById, LastModifiedDate, Name, SystemModstamp, CreatedById, CreatedDate, IsDeleted. Please check the security settings of this field and verify that it is read/write for your profile. : For Fields : IsConverted, LastModifiedById, LastModifiedDate, Name, SystemModstamp, CreatedById, CreatedDate, IsDeleted, .
Exception Type: System.Exception
I have checked my Security Field Levels and all of the fields listed are visible and read-only to the API User. Also, the System Administrator can NOT modify the Security Field Level of those fields.
Questions:
- Am I calling the right Web Method?
- Should I be calling update specifically?
- Is there some other restriction on the Lead Object?
Thanks, in advance, for your help,
Protected Sub PushingUpdate(ByVal submission As Submission, ByVal lead As SForceDevEnterpriseService.Lead) Dim leads As New List(Of SForceDevEnterpriseService.Lead) Dim upsertResult() As Salesforce.SForceDevEnterpriseService.UpsertResult Try leads.Clear() Me.PerformLeadSurveyUpdate(submission, lead) leads.Add(lead) upsertResult = Me.SalesforceEnterpriseService.upsert("Email", leads.ToArray()) Me.CheckForErrors(upsertResult, "Lead") Catch SoapEx As SoapException Dim sMessage As String = SoapEx.Message Catch ex As Exception Me.LogError(ex) End Try End Sub
Protected Sub PerformLeadSurveyUpdate(ByVal submission As ListrakIntegration.Common.LARTS.Entity.Submission, ByRef lead As SForceDevEnterpriseService.Lead)
'SurveyQuestions
For Each oQuestion As SurveyQuestion In submission.SurveyQuestions
Select Case oQuestion.Label.Trim()
Case "Current ESP"
If Not (oQuestion.Answer.Trim() = String.Empty) Then
If Not (lead.Survey_Current_ESP__c = oQuestion.Answer) Then
lead.Survey_Current_ESP__c = oQuestion.Answer
End If
End If
Case "Current Problems"
If Not (oQuestion.Answer.Trim() = String.Empty) Then
If Not (lead.Survey_Current_Problems__c = oQuestion.Answer) Then
lead.Survey_Current_Problems__c = oQuestion.Answer
End If
End If
Case "Demo Request"
If Not (oQuestion.Answer.Trim() = String.Empty) Then
If Not (lead.Survey_Demo_Request__c = oQuestion.Answer) Then
lead.Survey_Demo_Request__c = oQuestion.Answer
End If
End If
Case "Email Volume"
If Not (oQuestion.Answer.Trim() = String.Empty) Then
If Not (lead.Survey_Email_Volume__c = oQuestion.Answer) Then
lead.Survey_Email_Volume__c = oQuestion.Answer
End If
End If
Case "ESP Name"
If Not (oQuestion.Answer.Trim() = String.Empty) Then
If Not (lead.Survey_ESP_Name__c = oQuestion.Answer) Then
lead.Survey_ESP_Name__c = oQuestion.Answer
End If
End If
Case "Plans to Purchase"
If Not (oQuestion.Answer.Trim() = String.Empty) Then
If Not (lead.Survey_Plans_to_Purchase__c = oQuestion.Answer) Then
lead.Survey_Plans_to_Purchase__c = oQuestion.Answer
End If
End If
Case "Pricing Request"
If Not (oQuestion.Answer.Trim() = String.Empty) Then
If Not (lead.Survey_Pricing_Request__c = oQuestion.Answer) Then
lead.Survey_Pricing_Request__c = oQuestion.Answer
End If
End If
Case Else
End Select
Next
End Sub
Ok, I was able to resolve this issue....
Basically, when I was querying the Lead object I was returning the offending fields within the sObject. Therefore, I removed those fields from the select statement and the update worked appropriately.
All Answers
Ok, I was able to resolve this issue....
Basically, when I was querying the Lead object I was returning the offending fields within the sObject. Therefore, I removed those fields from the select statement and the update worked appropriately.