I’m trying to do the following:
filter records in the table by a cell number AND by whether a cell says “voicemail” or “text message” - so I want to find records that match the cell number and where the VMorText cell is “text message”. Cell type is computed (problem 1)
After that - find the record that was created first in the resulting array (problem 2)
Part of the script below
// getting ID for new record
let config = input.config();
let TxtrecordID = config.TxtRecordID;
let Txtcellnumber = config.TxtCellnumber;
// get cell number
let Txtsearchfield = await Txttable.getField('Cell number');
// define search area as Ticket table
let Txtsearcharea = await Txttable.selectRecordsAsync()
// list records that match cell number - problem 1
let matchingTxtRecords = Txtsearcharea.records.filter(cellnumber => {
return cellnumber.getCellValueAsString(Txtsearchfield).includes(config.TxtCellnumber)
})
// try to select first record from array - problem 2
let firstTxtrecord = matchingTxtRecords[0];
problem 2 I don’t even know how to start - I wondered if [0] would always be the first but it seems to change
Can anyone provide any hints toward a solution? Sorry this is quite open ended!
