Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

Can't write multiple records from custom app

Topic Labels: Custom Extensions
Solved
Jump to Solution
2140 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Stevan_Popovic
5 - Automation Enthusiast
5 - Automation Enthusiast

I am trying to write multiple new records to a table. The docs suggest doing this like so:

table.createRecordsAsync([{'My field name': '1'}, {'My field name': '2'}, {'My field name': '3'}]);

In my code I have the following test:

table.createRecordsAsync([{ 'Name': "Dave"}, { 'Name': "Sam"}])

But I get the below error:

invalid record format. please define field mappings using 'fields' key for each record definition object

As a check, I also attempted to write a single row, like so:

table.createRecordAsync({ 'Name': "Dave"})

And this worked fine.

I also attempted this:

table.createRecordsAsync([{ 'Name': "Dave"}])

And I got the same error as before. So it seems to be something about the createRecordsAsync method and passing an array.

Any ideas?

1 Solution

Accepted Solutions
somehats
6 - Interface Innovator
6 - Interface Innovator

Hey @Stevan_Popovic! This looks like a mistake in the guide you linked. The API docs for table.createRecordsAsync have the correct syntax. Instead of table.createRecordsAsync([{ 'Name': "Dave"}]), you need to wrap you cell values in a fields object, like this: table.createRecordsAsync([{ fields: {'Name': "Dave"} }])

Or with several records:

table.createRecordsAsync([
    { fields: { 'Name': "Dave" } }, 
    { fields: { 'Name': "Sam" } },
]);

Thanks for pointing this out! We’ll get the getting started doc fixed soon.

See Solution in Thread

2 Replies 2
somehats
6 - Interface Innovator
6 - Interface Innovator

Hey @Stevan_Popovic! This looks like a mistake in the guide you linked. The API docs for table.createRecordsAsync have the correct syntax. Instead of table.createRecordsAsync([{ 'Name': "Dave"}]), you need to wrap you cell values in a fields object, like this: table.createRecordsAsync([{ fields: {'Name': "Dave"} }])

Or with several records:

table.createRecordsAsync([
    { fields: { 'Name': "Dave" } }, 
    { fields: { 'Name': "Sam" } },
]);

Thanks for pointing this out! We’ll get the getting started doc fixed soon.

Stevan_Popovic
5 - Automation Enthusiast
5 - Automation Enthusiast

Thanks. That’s working for me now. Much appreciated.