Skip to main content

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 = l"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)

just above your await line you could add


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

or something similar.


just above your await line you could add


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

or something similar.


Thank you! This is perfect


Reply