Hello all
Have a script that creates new records in a table and then populates select fields in these newly created records with values from previous values. Works good, but I am interested in adding a new conditional argument that will do the following:
IF: “Previous Assessment Status" is any value other than “First Assessment" or “Not Assessed";
THEN: “Current Assessment Status" should be the value of “Previous Assessed";
ELSE: the value of “Current Assessment Status" should be “Not Assesed"
Hoping someone can help with the structure of the conditional logic. Script is below:
let {foundRecordNames, foundRecordDate, linkedRecordID, valStartupID, prevStatus} = input.config()
//Set the table to create the records in
let table = base.getTable('TRK: 360° ASSESSMENT')
let recordsToCreate = new Array;
for (let i = 0; i < foundRecordNames.length; i++){
recordsToCreate.push({
fields:{
"Previous Assessment Status": {name: prevStatus[i]},
"Current Assessment Status": {"name": "Not Assessed"},
"Area Assessed": [{id: foundRecordNames[i]}],
"TRK: ASSESSMENT": [{id: linkedRecordID}],
"Startup Name": [{id: valStartupID}],
"Assessment Date": foundRecordDate
}
})
}
