n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
45.52k stars 6.27k forks source link

SendGrid Contact Create/Update does not work with number fields #3058

Closed Passana closed 1 year ago

Passana commented 2 years ago

I have a custom field in Sendgrid with type = number

With Contact Create/Update I pass a value to SendGrid (using Custom Fields)

SendGrid then reports an Import error, because the field type does not match

It seems as if n8n does deliver a string to the custom field with type number and that runs in an error

Joffcom commented 2 years ago

Hey @Passana,

I have just given this a go and I don't appear to be able to reproduce it, I have created a field in SendGrid called test_field and selected number then in n8n I have added a set node that creates a number and I have added 2 SendGrid nodes one to update an existing contact and one to create a new contact.

Can you try the workflow below and see if that works? I am running n8n 0.170.0 using Docker on a Linux host with an nginx reverse proxy.

{
  "nodes": [
    {
      "parameters": {
        "resource": "contact",
        "email": "jonathan@joffcom.net",
        "additionalFields": {
          "customFieldsUi": {
            "customFieldValues": [
              {
                "fieldId": "e1_N",
                "fieldValue": "={{$json[\"test\"]}}"
              }
            ]
          }
        }
      },
      "name": "SendGrid",
      "type": "n8n-nodes-base.sendGrid",
      "typeVersion": 1,
      "position": [
        140,
        180
      ],
      "credentials": {
        "sendGridApi": {
          "id": "87",
          "name": "SendGrid account"
        }
      }
    },
    {
      "parameters": {
        "values": {
          "number": [
            {
              "name": "test",
              "value": 5
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        -20,
        260
      ]
    },
    {
      "parameters": {
        "resource": "contact",
        "email": "foo@bar.com",
        "additionalFields": {
          "customFieldsUi": {
            "customFieldValues": [
              {
                "fieldId": "e1_N",
                "fieldValue": "={{$json[\"test\"]}}"
              }
            ]
          }
        }
      },
      "name": "SendGrid1",
      "type": "n8n-nodes-base.sendGrid",
      "typeVersion": 1,
      "position": [
        140,
        340
      ],
      "credentials": {
        "sendGridApi": {
          "id": "87",
          "name": "SendGrid account"
        }
      }
    }
  ],
  "connections": {
    "Set": {
      "main": [
        [
          {
            "node": "SendGrid",
            "type": "main",
            "index": 0
          },
          {
            "node": "SendGrid1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Joffcom commented 1 year ago

Hey @Passana,

I have not heard anything back on this one for a while so I am going to mark it as closed, If you are still seeing this issue let me know and we can open it again.