I am trying to build an API which under the hood will perform CRUD operations against the Salesforce API. I'm using the node-salesforce library for communication with Salesforce.
An example of creating a new Contact
record:
let newContact: SalesforceContact = {
firstName: contact.firstName,
lastName: contact.lastName,
email: contact.email,
}
let response: any
try {
response = await sf.sobject('Contact').create(newContact)
} catch (err) {...}
Which is fine, but when I try to do the same for Lead
:
let newLead: SalesforceLead = {
name: lead.name,
email: lead.email,
}
let response: any
try {
response = await sf.sobject('Lead').create(newLead)
} catch (err) {...}
I get an error:
"INVALID_FIELD_FOR_INSERT_UPDATE: Unable to create/update fields: Name. Please check the security settings of this field and verify that it is read/write for your profile or permission set."
Or when I try to pass {name, email}
to the Account
sobject, I get the same error for email
. Once I remove it - I can create accounts.
So, apparently some of the fields in the object that I pass are wrong or non-existent. I am wondering if there is a place to find reference or documentation about the Salesforce API's schema.
I have tried searching stuff, but I mostly find examples of certain queries. And I need to have a full reference of the fields, so I have my options.