Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Update single Select Status in my script

Topic Labels: Extensions
Solved
Jump to Solution
393 2
cancel
Showing results for 
Search instead for 
Did you mean: 

I have a single select field named “STATUS” and I want to configure a button that would copy a record with all the following attributes and then make that new duplicate record’s STATUS set to “Voucher Re-Issued”.

Below is the script I use to duplicate the record, I just not sure where or how to configure the STATUS to “Voucher Re-Issued”

let table = base.getTable("Relocation")
let query = await table.selectRecordsAsync()
let records = query.records

let fields = table.fields

let exclude = ["UNIT ADDRESS [FULL]", "BR", "UNIT FAILED OUTCOME", "Voucher Expiration Date", "STATUS", "UNIT QUALITIES", "PENDING PO DOCS", "LEASE-UP SELECT", "PENDING DOC/VERIFICATION (TENANT)", "STREET ADDRESS", "CITY", "ZIP CODE", "YEAR", "W9", "Owner Name", "UNIT #", "Lease Up", "Data Entry Complete"]

let filteredFields = fields.filter(x => !exclude.includes(x.name) && x.isComputed == false)

let original = await input.recordAsync("Original Record", table)

let obj = {}

filteredFields.map(x => {
    Object.assign(obj, {[x.name]: original.getCellValue(x.name)})
})
await table.createRecordAsync(obj)
1 Solution

Accepted Solutions

just above your await line you could add

obj["STATUS"] = {name: "Voucher Re-Issued"}

or something similar.

See Solution in Thread

2 Replies 2

just above your await line you could add

obj["STATUS"] = {name: "Voucher Re-Issued"}

or something similar.

Thank you! This is perfect