19

My organization uses a third-party relational replication tool to sync data between Salesforce and a SQL Server database. The replication software is written in Java and uses the Salesforce API for its CRUD operations. Each object, both standard and custom, is represented in the database as a table that, in addition to all object fields, contains additional fields that are used for replication purposes.

When trying to insert a record into Salesforce via MSSQL, I get this error: "Contact failed to create: Required fields are missing: [LastName]" but the LastName field is positively not empty or null. Today is the first time receiving this error on the Contact – I've successfully created Contact records this way in the past. To start, I've checked on this with the vendor and was told it has something to do with permissions of the user account under which the replication is running. I've checked everything I can think of related to the running user's permissions on the Contact record, but before throwing it back at the vendor I want to make sure there isn't anything obvious I'm missing.

Here is what I've checked so far:

  • Role: Admin
  • Profile: System Administrator
  • Profile has all object permissions enabled
  • Read and Edit permissions on the Name field are both set
  • Field-level security on the Name field is set to visible (read-only not selected)
  • No Contact triggers changing the value of LastName
  • No validation rules set on the LastName field
  • No workflow rules set on the LastName field
  • Confirmed I can create the identical record through the GUI under the running user

Is there anything else I should check? Is it fair to think it could be related to vendor replication code?

  • Some Validation Rules / Sharing Settings? – Sergej Utko Jun 14 '13 at 20:17
  • 2
    Check FirstName, LastName permissions, Name on Contact is a readonly field. Have you added any workflows or triggers recently that might be "sanitizing" the names, looking for duplicates and whatnot? Might be something in your code that eventually wipes the value. What happens if you take "this user" and attempt to create Contact with same data from GUI? – eyescream Jun 14 '13 at 20:19
  • Many a times it is easy to get the data and try to recreate the sample data in the system manually.You can easily identify if the error is a validation error. It could be highly possible that there are some validation rules that are triggered and the system is throwing the top error from stack. Just try to insert the data you are trying to create from the API.It is a personal approach that I would take even thought it is a little cumbersome and painful approach for many – Rao Jun 14 '13 at 20:23
  • 8
    To pinpoint it to the integration tool, maybe you can try creating a csv with the data for the contact and try creating it using Dataloader or Jitterbit. If it is successful there, then you know you can create contacts through the API. – Daniel Hoechst Jun 14 '13 at 21:22
  • 1
    Did you check for any code that might be firing and creating a second new contact record that might have a blank last name? – Matt Lacey Sep 2 '13 at 1:37
3

In short, there's four components that determine what goes into Salesforce (assuming stable connections, no weird firewalls that strip data from messages etc).

  1. The original data
  2. The mapping of original data to SF Objects
  3. Triggers etc. in SF
  4. Access rights in SF

It seems you ruled out 1, 3 and 4 to be the problem, so there's no other conclusion that 2 is the problem.

Check a network analyzer like WireShark to see what is actually going over the line, and try other import tools like DataLoader to check if the import still fails when you know that 2 is good. Possibly, create an Apex Trigger on the Account Object and System.debug(...) all incoming data, especially the LastName field.

0

Is it definitely a contact record that is causing this error? Have you got person accounts enabled on your org? These are like a hybrid of account and contact.

I've seen an error message like this during insert of an account, when the record type of the account was for a person account but the contact mandatory fields were missing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.