Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Update single Select Status in my script

Topic Labels: Extensions
Solved
Jump to Solution
1416 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Drew_Nemer
8 - Airtable Astronomer
8 - Airtable Astronomer

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
Kamille_Parks
16 - Uranus
16 - Uranus

just above your await line you could add

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

or something similar.

See Solution in Thread

2 Replies 2
Kamille_Parks
16 - Uranus
16 - Uranus

just above your await line you could add

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

or something similar.

Thank you! This is perfect