Hi All,
So I've got a Javascript query (see below) which is trying to store a variable selectedFields to SaveLastRun.data however, I am getting an undefined stored on data when I run the script.
Checked the console.log and it is showing the correct WorkID number and data length, but I am getting an additional error (see below).
Javascript query
// Assuming your table component is named "tableorders"
const table = TableOrders;
// Get the last row index
const lastRowIndex = table.data.length - 1;
// Select the last row with an empty options object
table.selectRow(lastRowIndex, {})
// Replace "fieldName" with the name of the field you want to select
const selectedField = table.data[lastRowIndex].WorkOrderID;
SaveLastRun.data = selectedField;
console.log("Selected Fields: " + selectedField);
console.log("Data Length: " + table.data.length);
Error:
Error:Options must be an object.
in TableWorkOrders.selectRow()
in SaveLastRun2.trigger()(SaveLastRun2)
- additionalScope: {}
triggeredById: ""environment: "production"
Cheers,