Hi guys,
I've been trying to puzzle out this challenge on the modern designer, I need to make this work that whenever the user clicks on the submit button and there is an empty row in the table, in this case row 3 is empty. The script should delete the entire row , like in this image:
This is how I scripted it but it does not function as expected:
LFForm.onFormSubmission(function () {
var rowCount = LFForm.getFieldValues("Deletion").length;
for (var i = rowCount - 1; i >= 0; i--) {
console.log(LFForm);
var rowData = LFForm.getFieldValues("Deletion")[i];
// Check if the row is empty (modify condition based on actual fields)
if (!rowData || Object.values(rowData).every(value => value === "" || value === null)) {
LFForm.deleteRow({variableName: "Deletion"}, i);
}
}
});