Why can’t update Airtable Record using a custom action?

@Productology did you fill the inputs with example data? You can find them in the Airtable API docs page!

I did not.
Another error came up, tho:

{
  "error": {
    "type": "AUTHENTICATION_REQUIRED",
    "message": "Authentication required"
  }
}

EDIT: Never mind, I copy-pasted again the Bearer string and now it works.

2 Likes

As a tip, PATCH, only updates fields you select, so if you only want to update Email, you can use it, PUT is used to update all fields, so if you would leave any field out of it (In the PUT), it will get empty data.

1 Like

I’m not sure I understood how to do that.
I’m using this Custom Action to record new users into Airtable after a signup.
I set this action in the “Submit button” of the signup form:

I’m leaving “ID” empty, since I don’t know what to put in there.
I assume that Airtable will fill that automatically, just like it will do with “createdTime” (that I did not set up at all in the Custom Action).

Now, in another screen, I ask the user to verify the email address, and if this happen, I check as “True” in a boolean “Email Verified?” field of my Users collection. I’d like to mirror that also in the Airtable table.
So, alongside the action “Update > Logged In Users > Email Verified is true”, I should set the custom action I already used in the sign up form. But what ID should I set?

When a user signup, I generate a UUID as an automatic action:

This value is not in the form of Airtable ID (i.e. rec0D6bQHkBVKweEh)
Can I use is as ID, both in the Custom Action in the signup form and in the Custom Action when the user verified the email?

Yep. When updating and deleting you need to add the id.

In where? In the custom action id field?

As far as I’m aware you can’t add a value to the id field ( if it is you get a error message called Action Cannot be completed ) and Airtable generate a id. If you need this you can create another column and store this. And also there’s a limitation that Custom Action don’t work on forms and also there’s a limitation on the Signup form that for create,update records using Logged in user > properties you need to add them on another screen.

Ok, so to overcome this instead of setting up the custom action on the signup form, I set it up on the first page of the onboarding funnel. So, after sign up user are redirected to page 1, and on page 1 I set the automatic custom action.

Exactly. In the custom action id field when my goal is to update the existing record, not creating a new one.

Are you creating the record on Airtable before verifying the email or after verifying email? Are you using a custom action or just the create action?

This is the process:

Signup Page:

  • It contains Signup Form
  • It creates the User record on the Adalo collection
  • it redirects to Page 1 after signup

Page 1

Page 2

  • When opened, I’d like to update the Airtable record (created on the previous page) by changing the boolean value of “Email Verified?” from “empty” to “true”.

You can create a property to store the Airtable id on the Users collection. After the Custom action you can add a update logged in user action that adds the id to that created property in the Users collection. To get the id you should see a section with the custom action name and the results. But if you add this on the screen actions section then you won’t see this section due to current limitation. For this you can add a countdown on the screen and add these actions on the countdown finished actions section. You can add the verify user custom action there too. Or you can use the id from the custom action directly without storing it in the users collection.

Then in the page 2 you can use the update action and add that property that you created to store the id of the Airtable record for the id field and update the boolean.

I did everything you suggested, but it doesn’t work: no record is created on Airtable.

I did not insert a countdown, but the “After Signup” screen, with a button that in theory should create the Airtable record and update Adalo’s property with records.id.

In the Custom action setup does the user created on Airtable? Does the ID is a column that you created? If that is the id that Airtable create I’m guessing you don’t need the id here or you need put the email there ( not sure. unable to test it now because I’m with my phone now :upside_down_face: )

Never mind, I’m using the solution you proposed in another topic (Cannot create a record on External Collection (Airtable) - #2 by dilon_perera) and it’s working.
I guess I’ll just drop the idea of using Custom Actions to create/update Airtable records, and I’ll use the “External collection” option offered by Adalo.

1 Like

I tested on my side, and both Airtable submissions and Custom action works. I would need to check your backend to see the issue. If you are happy as it is then no need :slight_smile: .

1 Like

Actually, it would be great if you could check my backend.
Using only the solution proposed by @dilon_perera on the other topic is not enough, because sometime I need the Custom Action.

Right now I’m creating Airtable records using the Create action of Adalo, and it works.
When I have to update an existing Airtable record sometime I can use the Update action of Adalo (when the newly created Airtable Record is among the available data in the screen), but sometimes I can’t. In this second occasion, I necessarily need the Custom Action to update the Airtable record.

I created a new property to the Adalo Users collection called “Airtable ID”, and when users signup the Airtable IDs are successfully stored there.
Then, when I try to update the Airtable record with a custom action "setting id = “Logged in user’s Airtable ID”, nothing happens.

Yes, Update Airtable with Adalo “Native” action, only if you are in a “Current Airtable Record” because adalo needs to connect to api and collect data.

For the custom action also correct you can use anywhere as long as you use custom action with record ID.
I just tested from my side.

Something like this:

How it looks without magic text:

image

With Magic Text:
image

“NewName” could just be used as Input text field, in this case.

That’s exactly what I did, but it doesn’t work!
For the custom action “Create User”, I used this configuration:


For the custom action “Update User”, I used this configuration:


The record is not created.
If I use the “native” Adalo “Create Record in an External Collection” the record is created, but then when I try to update it with the aforementioned Custom Action, it isn’t updated.

Hi, I would need to check your airtable table and the custom action. Are all Airtable fields with similar structure as Adalo JSON Request? E.g. Number, text fields and so on.

I formatted the Adalo JSON Request using the example values provided in the Airtable API documentation.

I think I found the problem: both in the Create and Update action, if I leave one field empty, the action doesn’t work.
I tried filling every available field (even putting “false” in boolean fields), and both actions work.

Hi @Productology ,
In the Patch I would expect that (A PUT Would just put all blank) if API follows standards.
For the create action, this is odd, because if you don’t have a mandatory field, this by default, should not happen and just ignore the empty value.

I will test this later. Cheers.