Help

Re: 'record' parameter type in updateRecordAsync() not compatible with input.recordAsync()

Solved
Jump to Solution
926 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Sarah_Viljoen
6 - Interface Innovator
6 - Interface Innovator

Hi there :slightly_smiling_face:
I’m new to coding and Airtable and I need some assistance.
My script is to update a record with user input. The issue I’m running into is in line 7. The script runs but I’m assuming it is this error that stops it from actually updating the cell. I understand the error but I’m just not sure how to remedy it. I’d also like to know how to output the new_date variable within the text output line above it.
Screenshot (2)
2

1 Solution

Accepted Solutions
kuovonne
18 - Pluto
18 - Pluto

You are getting the squiggly red underline that says “record is possibly null” because it will be null if the user closes the record picker without selecting a record.

Your other issue is that a date field need to be set to an ISO date string. You cannot use Airtable formulas to parse the date. You need to use JavaScript to parse the date and then convert the date to an ISO string.

See Solution in Thread

6 Replies 6

Hi @Sarah_Viljoen
Your variable record should return two items, id and name. I think you need to pass the id into the update. So record.id

Sarah_Viljoen
6 - Interface Innovator
6 - Interface Innovator

Hi @Vivid-Squid
I tried that but then it says “Object is possibly null” and it doesn’t work. I also then have the issue (I think this is the issue) where the string passed into new_date by the user needs to be a date variable, not string. I’ve tried using DATETIME_PARSE() to convert it to a date but it isn’t recognizing the argument at all.

kuovonne
18 - Pluto
18 - Pluto

You are getting the squiggly red underline that says “record is possibly null” because it will be null if the user closes the record picker without selecting a record.

Your other issue is that a date field need to be set to an ISO date string. You cannot use Airtable formulas to parse the date. You need to use JavaScript to parse the date and then convert the date to an ISO string.

Thank you so much ! I will go check out how to use JavaScript to do that and I’ll come back with any questions if I’m still having issues.

Sarah_Viljoen
6 - Interface Innovator
6 - Interface Innovator

This is probably a very simple issue but I can’t seem to get it right. I’m still having trouble with converting a string variable to a date. My ESC DATE field is a date field and it’s where the user input will go. I just need to convert what the user inputs (they are prompted to type it as ‘Month Day, Year’) to a variable type that will be compatible with my date field. I checked out the links you kindly provided me with but I’m still confused.

Sarah_Viljoen
6 - Interface Innovator
6 - Interface Innovator

@kuovonne I got it working ! I played around using the links you provided. Thanks so much for all the help ! @Vivid-Squid, the ‘record.id’ does work, I just thought it didn’t because of the red squiggly line. Thanks for helping me !