Welcome to the Airtable Community! If you're new here, check out our Getting Started area to get the most out of your community experience.

Only first row updating (updateRecordsAsync)

Topic Labels: Scripting extentions
Jump to Solution
271 3
Showing results for 
Search instead for 
Did you mean: 

Trying to take Object returns from my PHP endpoint and populate the rows of a table - only the first row is being populated (aka cell fields in first row only) - here is my code:

// query for every record in "People"
let table = base.getTable("SMS");
let view = table.getView("All");
let query = await view.selectRecordsAsync({fields: ["Contact","URL"]});

var json_payload = [];

let individual_injection = {};

for (let record of query.records) {

    let name = record.getCellValueAsString("Contact");
    let URL = record.getCellValueAsString("URL");

    individual_injection = {
        'Name': name,
        'URL': URL



let response = await remoteFetchAsync('', {
    method: 'POST',
    body: JSON.stringify(json_payload),
    headers: {
        'Content-Type': 'application/json',
        'Authorization' : 'Basic d2h5d29udHlvdWNvbm5lY3Q6Y2N1WSAxWWhkIDdsTmkgMzdWSSB5MVlyIDYySEs='

    let body = await response.json();

    for (let i = 0; i < body.length; i++) {
        RecordID = body[i].recordID;
        ShortLink = body[i].shortURL;
        LinkID = body[i].linkID;
        await table.updateRecordAsync(RecordID, {
            "LinkID": LinkID,
            "Shortlink": ShortLink

    console.log("If you see this we have made it home Master Wayne");


Here is what I see:

As you can see only first row is updated when the script is run but I have checked objects and the values are definately there - it even gets echoed on console log if I review

Thank you!

1 Solution

Accepted Solutions

It looks like all the record ids are the same in your payload.

See Solution in Thread

3 Replies 3

It looks like all the record ids are the same in your payload.

Not the case… I don’t think. This is the JSON.stringify of the load I send to my PHP endpoint - I just checked and I saw multiple Record ID’s - Image 2022-06-20 at 11.59.3...

Never mind… you’re right… I just checked my return and all the RecordID’s are the same… so strange… but this should help me further troubleshoot my problem… thank you!