Dispatching the articles
As soon as the dispatch person enters the shipment details in the dispatch form and submits it, the script should update the shipment details in the spreadsheet and should send a notification e-mail to the user. So, we will add the dispatchOrder
server function to handle these tasks:
function dispatchOrder(form){ // Shipment details column number minus 1. const SHIPMENT_DETAILS = 9; var orderNumber = form.order_number; var deliveryAddress = form.delivery_address; var userEmail = form.email; var shipmentDetails = form.shipment_details; var data = SheetOrders.getDataRange().getValues(); for(var i = 0; i < data.length; i++){ if(data[i][0] == orderNumber){ SheetOrders.getRange(i+1, SHIPMENT_DETAILS+1) .setValue(shipmentDetails); var htmlBody = "<p>Order number: " + orderNumber + " has been dispatched to </p>" + "<p>" + deliveryAddress + "</p>" + "<p>By...