I am experiencing an issue with my Google App Script trigger not firing appropriately. My google Spreadsheet has two sheets. One that holds inventory and the other that tracks order quantity. I have a hookup with Zapier, so when a new order is placed it adds a new row to the 'Orders' sheet. I want my main function to run whenever an order is placed and a new row is added to the 'Orders' sheet. Currently, it will fire if I go into the sheet and manually edit information but it will not fire when Zapier adds a row automatically.
Here is the code:
function onEdit(e) {
var activeSheet = e.source.getActiveSheet();
var range = e.range;
if (activeSheet.getName() !== 'Orders') return;
var productOrdered = orderID();
var amountOrdered = orderQuantity();
var productList = productArrayFunction();
var productMatched = findMatchingProductId(productList,productOrdered);
var rowNumber = lookup(productOrdered);
var subtractInventory = subract(rowNumber,amountOrdered);
}
I might be going about this the wrong way but I feel like this should work as intended. I am not a coding expert so any guidance would be greatly appreciated.
onEdit()
. The question should be addressed to Zapier support. Depending on how it operates, It maybe able to call a another function. Without Zapier add-on(?) source code(?), I can't say much. – TheMaster