I can't create an account in Salesforce

Hello everybody,

I am facing an issue while trying to create accounts (which are personal accounts) pushing data from my Postgres database towards my Salesforce. I have no problem for creating Contacts or Opportunities but for Account it keeps showing the same error message to me whereas it should be a very easy workflow.

The error message is : ERROR: Bad request - please check your parameters

“message”: “400 - [{“message”:“record type missing for: Compte”,“errorCode”:“CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY”,“fields”:[]}]”,
“name”: “Error”,
“stack”: “Error: Request failed with status code 400 at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15) at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (node:events:525:35) at IncomingMessage.emit (node:domain:489:12) at endReadableNT (node:internal/streams/readable:1358:12) at processTicksAndRejections (node:internal/process/task_queues:83:21)”

Here is the code behind our nodes :

Does anybody have an idea of what is going on please ?

Cheers,
Quentin

Hey @Quentin_Musson,

Welcome to the community :tada:

I have just given the Salesforce node a quick test here and it appears to be working fine, Are you able to share the output of your Postgres node? I suspect there could be an issue with the data coming out of it.

Hey @Jon
Thanks for reaching out and for your welcome! :slight_smile:

Here is a sample output of my Postgres node :

[
{
“id”: 2,
“email”: “[email protected]”,
“firstName”: “first”,
“lastName”: “last”,
“ideelUserId”: “17e87f0e0b6f2-0e5a07260fbd6c-20253023-410a0-17e87f0e0b7a7”,
“assignedSalesId”: null,
“phoneNumber”: “012345678”,
“createdAt”: “2022-02-16T13:34:07.070Z”,
“updatedAt”: “2022-02-16T13:34:07.070Z”
},

And then my Salesforce node is basically to cereate an account with a concatenate of first name and last name as new Salesforce account name.

{
“meta”: {
“instanceId”: “6a25174c4de89463d38ce4f656eef462ae849b02f017ff6f25dc896bdfbc0b9f”
},
“nodes”: [
{
“parameters”: {
“operation”: “executeQuery”,
“query”: “select * from users limit 10;”,
“additionalFields”: {}
},
“id”: “c0808611-4a71-4caa-8477-4d9d29a1dabb”,
“name”: “Postgres”,
“type”: “n8n-nodes-base.postgres”,
“typeVersion”: 1,
“position”: [
140,
300
],
“credentials”: {
“postgres”: {
“id”: “15”,
“name”: “Postgres account 2”
}
}
},
{
“parameters”: {
“resource”: “account”,
“name”: “={{ $json["firstName"] }} {{ $json["lastName"] }}”,
“additionalFields”: {}
},
“id”: “4877f9e8-e68e-4841-b44e-30d784d36ad0”,
“name”: “Salesforce”,
“type”: “n8n-nodes-base.salesforce”,
“typeVersion”: 1,
“position”: [
340,
300
],
“credentials”: {
“salesforceOAuth2Api”: {
“id”: “14”,
“name”: “Salesforce account 2”
}
}
}
],
“connections”: {
“Postgres”: {
“main”: [
[
{
“node”: “Salesforce”,
“type”: “main”,
“index”: 0
}
]
]
}
}
}

Hi @Jon did you have a chance to have a look at my output data ? :blush:

Hey @Quentin_Musson,

I had not, Looking at it there are multiple items, What I am after ideally is the full output of the node. I guess another quick test could be can you use the Salesforce node on it’s own and manually input the data and see if that works? The error is coming back from Salesforce but I am not sure what it actually means so I just want to make sure it is not something funky with the data being sent.

Thanks for looking at it @Jon
I tried the basic test you were suggesting (executing the Salesforce node on its own with manual input as account name) and it still doesn’t work, I get the same error message :

{
“message”: “400 - [{“message”:“record type missing for: Compte”,“errorCode”:“CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY”,“fields”:[]}]”,
“name”: “Error”,
“stack”: “Error: Request failed with status code 400 at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15) at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (node:events:525:35) at IncomingMessage.emit (node:domain:489:12) at endReadableNT (node:internal/streams/readable:1358:12) at processTicksAndRejections (node:internal/process/task_queues:83:21)”
}

It is actually very weird because as I said I have no issue with creating contacts or opportunities… Do you think it comes from our Salesforce setup with Person Account parameters ?

Hey @Quentin_Musson,

It could do, Do you have any validation rules in Salesforce maybe?

Hey @Jon ,
No I checked everything in my Salesforce set-up and I don’t see anything in perticular… I am investigating with Salesforce support what could be the potential roadblock, I hope they can come up with a solution soon. I’ll let you know what they say.

1 Like