I think I've seen a thread on this but couldn't find with a search.
I am running a Server-side script (after-submit) on a transaction (sales order being created or approved), that is creating a customer record under certain circumstances.
How it works:
This new customer record is sourced to the transaction (parent-child) so I want to create the customer record and upon success, assign the ID from the new customer record to the transaction record parent-child field to link them. I want to provide a visual display if the customer record creation fails to tell the user to do it manually (or correct the error and try again).
1) Is there a way to throw an error that creates a visual error display in the user's browser? How do you do that if there is?
Also, I want to make sure my logic is right in doing these two tasks (creating a new customer record and then updating the existing transaction) Here is the pseudo code. Appreciate any feedback and if I'm missing something.
1. Get Transaction Record (nlapiGetNewRecord???) just submitted. 1a. On Error, visually display to user and exit. 2. Get pertinent field values from transaction 3. Create New Customer record. 3a. On Error, visually display to user and exit. 4. Set fields in Customer record. 5. Submit/save Customer Record and get returned Id of new Customer Record. 5a. On Error, visually display to user and exit. 6. Set parent-child sourced field in transaction with Customer Record ID. 7. Submit/save Transaction with updated field. 7a. On Error, visually display to user and exit.