Help

Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

UpdateRecordASync for Lookup ffor multiple values

Topic Labels: Scripting extentions
Solved
Jump to Solution
552 1
cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to push multiple values in a look-up table at once to a single update field.

So far I am filtering the record, finding the IDs of the values in one of the values. Pulling out specific ones and then I am not sure what to do to update multiple values inside of a new field with a look-up table.

Note, I didn’t copy and paste properly. The syntax is not the problem, the problem is that I do not know how to get the multiple look-up values to update.

//// CODE BELOW

testID = “recZnhmuRKPJEvVE0”

let t_results = base.getTable(“results”)//
let thisrecord_as = await t_results.selectRecordsAsync();
let thisrecord = thisrecord_as.records.filter(f_record =>
f_record.getCellValueAsString(“cli_res_id”) ==testID );

for (i=0; i<thisrecord.length; i++) {
let this_spec = thisrecord[i].getCellValue(“Input_Look_Up_Field”)
let this_fm_id = thisspec.id
var pushval = { fields: {

        "UpdateField": [{id: this_fm_id}]
    }
    }

}

if (pushUpdates == 1) {

await t_Client_results.updateRecordAsync(testID, addtopfoods )

console.log(`l-241 -WOot It's OOOUT `)

}

1 Solution

Accepted Solutions

Nevermind. I solved it. I am just pushing the wrong values in the loop in the above code.

I created a var that I pushed the following to and then used

var pushthisvar =
pushthisvar.push( {id: this_foodmap_id})

updateRecordsAsync(record ID, {
“Field Name”: pushthisvar })

See Solution in Thread

1 Reply 1

Nevermind. I solved it. I am just pushing the wrong values in the loop in the above code.

I created a var that I pushed the following to and then used

var pushthisvar =
pushthisvar.push( {id: this_foodmap_id})

updateRecordsAsync(record ID, {
“Field Name”: pushthisvar })