Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Jun 12, 2022 12:15 PM
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)
Solved! Go to Solution.
Jun 12, 2022 01:11 PM
just above your await line you could add
obj["STATUS"] = {name: "Voucher Re-Issued"}
or something similar.
Jun 12, 2022 01:11 PM
just above your await line you could add
obj["STATUS"] = {name: "Voucher Re-Issued"}
or something similar.
Jun 13, 2022 04:55 PM
Thank you! This is perfect