function onSave(executionContext) { var formContext = executionContext.getFormContext(); var errorId = "error"; var eventArgs = executionContext.getEventArgs(); //To see the Save Mode return value in your browser console console.log("Save Mode = " + eventArgs.getSaveMode()); //If save mode is 'Save and Close' or 'Auto Save', inhibit default behavior i.e. save if (eventArgs.getSaveMode() == 2 || eventArgs.getSaveMode() == 70 || eventArgs.getSaveMode() == 1) { var productObj = formContext.getAttribute("product").getValue(); var assetObj = formContext.getAttribute("customerasset").getValue(); if (productObj == null && assetObj == null) { ...