In Quotes I had this all working perfectly for Sugar 7 but I'm having trouble in Sugar 12 with the new Sidecar Quotes module.
I have a custom Quotes header button next to "Edit" that says "Send to ERP" which takes all the quote data and line items and makes an API call to the ERP to insert as a sales order. In Sugar 7 this was very easy cause I would only display the "Send to ERP" button on the detail view which inherently meant that all QLI's were saved with their QTY, Sale price etc.
The problem I'm facing in Sugar 12 is how to detect if a QLI has not yet been saved and either FORCE a save programmatically through javascript on all unsaved line items (thats my preference) or produce an Alert that there are unsaved changes similar to when you try to navigate away from a page without saving.
Example 1:
User created a quote and fills out all header info and hits SAVE. When a record is NOT in edit mode, the "Send to ERP" button is visible. User adds a QLI to the quote which has a QTY of 5. User realizes they made a mistake and hits "EDIT" on the QLI and updates the QTY to 10. They then forget to save the Line item and hit "Send to ERP" which reads the DB and sends a QTY of 5 to the ERP but the user actually had updated it to 10.
Example 2:
Forget about my custom button and look at Sugar STOCK quotes. Same issue arises in another area. Create a quote, add a QLI to it. Click EDIT on one of the QLI's and change something about it like the QTY. Then WITHOUT saving the edited QLI, download the quote template as PDF. The PDF will spit out the previous QTY and not the recently edited but yet unsaved QLI.
I have to dummy proof the daylights out of this. My sales reps will constantly forget to save line items and send the wrong values to the ERP and wrong values on Quotes via PDF. Would love to hear any and all ideas on this. Thanks!