Help

Update Linked Fields with Automatinos

Topic Labels: Scripting extentions
535 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Giorgio_Bazziga
6 - Interface Innovator
6 - Interface Innovator

Hello,

I am trying to update linked fields but I am getting an error. I know updating linked fields is challenging in Airtable so I went for the scripting route.

Find my code below:

//grab info from TF inputs

let TFinputs = base.getTable("Fishel Inputs 2021");

let TFview = TFinputs.getView('Update Leaf Lease');

// grab record from previous input

let TFRec = input.config();

let queryTFinput = await TFview.selectRecordsAsync(); // get all records in TF inputs

let updated_record = queryTFinput.getRecord(TFRec.TFRec);

let TFPoleNum = updated_record.getCellValueAsString("Pole # Fix");

let TFPanelBar = updated_record.getCellValueAsString("Panel Barcode");

let TFLightBar = updated_record.getCellValueAsString("Light Barcode");

let TFPoleBar = updated_record.getCellValueAsString("Pole Barcode");

let TFDateIn = updated_record.getCellValueAsString("Day of Entry");

console.log(updated_record)

//grab record to update

let SLLease = base.getTable("Street Leaf Lease TEST");

let SLLview = SLLease.getView('Vanilla');

let querySLLease = await SLLview.selectRecordsAsync(); // get all records in SLLeaselet

var SLLPoleNum

// find record in array

for (let record of querySLLease.records) {

    // paste record found in TF clone

    if (record.getCellValue("Pole Number") == TFPoleNum){

        SLLPoleNum = record

        console.log(SLLPoleNum)

        //await TFinputs.updateRecordAsync(TFRec.TFRec, {

        //    "Record ID to update": SLLPoleNum

        //});

        SLLease.updateRecordAsync(SLLPoleNum, {

            'Light #': [

                ...SLLPoleNum.getCellValue('Light #'), 

                {id: updated_record.id}

            ]

        });

    };

};

With this I am getting

ERROR

TypeError: SLLPoleNum.getCellValue is not a function or its return value is not iterable

at main on line 41

The script is successful at pulling all the data it needs and finding the record to update and its relative fields to update but for the love of god I am not able to update the data in the field.
Light is just one of the fields I want to update, the complete list is all the “Barcodes” and “Date”

HELP please and thank you

0 Replies 0