This script is for when you want to allow FormMule to run when there is a change to any data in the sheet.
Thanks to Nolan Green for sharing the script.
Note: you will need to adjust the number of columns to be cleared. For FormMule is it one per template.
The script will only clear the status information. If the change is because of an Edit URL and there is a Form Trigger, then FormMule should start automatically.
If the script is triggered by an edit inside the spreadsheet, the status columns will be cleared but FormMule will not run immediately.
// Nolan Green shared this script with me. You need to change the columns and which sheet you
// want the script to use. See below.
//
//THIS IS THE BEGINNING OF THE SCRIPT THAT CLEARS FIELDS WHEN A ROW IS EDITED.
function onEdit(e) {
var currentSheet = e.range.getSheet();
var sheetEdited = currentSheet.getName();
var rowEdited = e.range.getRow();
var columnEdited = e.range.getColumn();
// column number where data should be cleared; A = 1, B = 2 etc
// change the sheet name (sheetEdited) as appropriate.
if(sheetEdited == "Form Responses 1" && ( columnEdited < 5 || columnEdited > 8)){
currentSheet.getRange(rowEdited,5).setValue('');
currentSheet.getRange(rowEdited,6).setValue('');
currentSheet.getRange(rowEdited,7).setValue('');
currentSheet.getRange(rowEdited,8).setValue('');
}
}
//THIS IS THE END OF THE SCRIPT THAT CLEARS THE AUTOCRAT FIELDS WHEN THE RESPONSES ARE EDITED