Hi everyone!
There’s a seemingly basic problem that’s driving me crazy: I have an automation that triggers a script to create a few records. When creating these records, I need to set the value of a single-select field. It works well when I assign a basic string to the variable, but fails when I use getCellValueAsString ! Anything I’m missing? (console.log on the result of getCellValueAsString shows the correct result and typeOf on the variable shows indeed “string”)
let tableMapOuvrages = base.getTable("Map ouvrages");
let tableTaches = base.getTable("Taches");
let inputConfig = input.config(); //get the variables from previous steps
let mapOuvrages = await tableMapOuvrages.selectRecordsAsync({
fields: "Ouvrage","Groupe ouvrage"]
});
for (let itemInMap of mapOuvrages.records) {
let basicString = "Livraison menuiseries";
let stringOuvrage = itemInMap.getCellValueAsString("Ouvrage");
console.log(stringOuvrage ); // this shows "Livraison menuiseries"
console.log(stringOuvrage ); // this shows "string"
// the "temp" field below is a single-select
let tache = await tableTaches.createRecordAsync({
"temp": {name: basicString } // This version works
// "temp": {name: stringOuvrage } // this version doesn't work !
});
}