Help

Not Able to get the updated Instance of a table inside loop of script

Topic Labels: Scripting extentions
Solved
Jump to Solution
1980 6
cancel
Showing results for 
Search instead for 
Did you mean: 
Noor
6 - Interface Innovator
6 - Interface Innovator

HI Everyone
I am sharing a problem today. Not sure is there any solution out there.
Please response if there any solution for that.

I am trying to get the latest available option for a select able field inside a loop of scripting apps script.
But the problem is script provide me the initial instant of the table if i make any change runtime of the script then it’s not getting the updated instance even though i try to take a new instance of the table .
Below is my code

while(true){
    
    var table= null
    table= base.getTable("Table 1")
    console.log(table.getField("Status").options.choices)
    console.log(await table.selectRecordsAsync())

//trying to make wait the loop
    var a= await input.buttonsAsync("test",["test"])


}

And also want to mention that it’s getting the all the new records in new instance of the table or the updated records are also available on it. But the updated fields options are not available in updated instance of the table.

May be it’s a bug from airtable

1 Solution

Accepted Solutions

Have the script create the select choice instead of the user. field.updateOptionsAsync()

See Solution in Thread

6 Replies 6

I don’t think that it’s a bug. It’s possible that Airtable “freezes” the field configuration (as far as the script is concerned) during script execution to prevent possible errors from occurring.

Could you explain more about your desired use case? Why do you want to change the field configuration while a script is running?

I think that the scripting environment gets a copy of the base object when the script is run, and the base object is not updated unless the script itself modifies the base schema.

This is different from a custom app, where the custom app can watch for changes to the base schema.

Noor
6 - Interface Innovator
6 - Interface Innovator

Thanks for your response.
I am try to take input from use and then after checking does the value exist or not in “Select able” fields
if not exist then user will add the value and test again. That was the use case.

I understand keep it freezing but i am sure script will through an error if you change anything table in runtime of the script.
If they do so then what’s the use of keep it freezing.

Can you please mention anyone from airtable so that they can explain the point of view
Thanks
Noor

Noor
6 - Interface Innovator
6 - Interface Innovator

Thanks you @kuovonne for your response

Yes it seems like the take the schema object copy on the stating of script run and don’t update it overtime even you re-query the object

Thanks
Noor

Have the script create the select choice instead of the user. field.updateOptionsAsync()

Noor
6 - Interface Innovator
6 - Interface Innovator

@kuovonne
That will be a good option. I was trying to find this type of function also.
Thanks @kuovonne
It will solve my problem