Sync Data from a Json Field to Airtable Field of Type User

Hello Geeks,
I am having a problem here. I want to sync data between postgres and Airtable. I am however facing difficulties syncing data between these two fields. I have an airtable field of type user.
From the Postgress node, I have this field email address/full name I want to sync this to this field Assignees of type user in Airtable.

Below is the error I am getting

ERROR: Your request is invalid or could not be processed by the service
422 - {"error":{"type":"INVALID_VALUE_FOR_COLUMN","message":"Cannot parse value \"[\"[email protected]\",\"[email protected]\"]\" for field Assignee"}} - Cannot parse value "["[email protected]","[email protected]"]" for field Assignee

These emails are for users invited in that particular airtable base.
Whether I use the exact usr_id or the email_address the error persists.
How can I go around that?

Hey @Anton_Odongo,

I think I don’t get your complete usecase, but that is maybe not necessary.

I read the error message like this: You cannot pass an array ob strings to that column

So what is maybe working is to pass just one email.

Please keep me posted.

Cheers.

image

This field Assignees is an Airtable Field

I want to load data into this field. this data is coming from another node.

Below is an image of the error and flow of when I have formatted my data to be the exact names of the users who have been invited in the base

Below is when I use the email address of the users

I still cannot figure a way how to add the assignee in the Airtable Assignee Field of type user.
@nico-kow

Hey @Anton_Odongo
Just played with the api a little bit and found out that a user filed is expection a structure like this:

[
 {
  "id": "usr7DtkkqjIWprNQe",
  "email": "[email protected]",
  "name": "Nico Kowalczyk"
 }
]

It is enough to just send the email

[
 {
  "email": "[email protected]"
 },
 {
  "email": "[email protected]"
 }
]

You can copy the Convert Email to Object node and place it before your airtable node. It converts one email to the necessary structure.

For multiple Emails you’ll need a code node I think. I dont have time now to implement it. Maybe later or you’ll figure it out by yourself.

Cheers.

Hey @Anton_Odongo
if youre setup did not change then you can create a code node right before your aurtable node with the following content:

for (const item of $input.all()) {

  const dataArray = item.json.assignee_airtable_ids.split(',')
    .map(email => email.trim())
    .map(mail => {
    return {
      email: mail
    }
  });
  item.json.assignee_airtable_ids = dataArray;
}

return $input.all();

It will map the mails (f.e. [email protected], [email protected]) to the structure airtaible expects.

Cheers.

Thank you let m try it out

Hey @nico-kow Thank you so much for this. It works like a charm. I had no idea that the format with which I send my data really mattered while mapping data to the assignee field of type User.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.