I am working with SyteLine ver. 10 in the cloud, and I need to make the Customer PO field on the Customer Orders form required (can't save without entering one). Thanks in advance.
Make that field on the form Required. When in Design Mode, there is a property of the Customer Po field for Required, set it to True.
Also make it required on the grid component, otherwise you may find it doesn't work as you expect.
Thanks, I tried making the field "Required", however while it highlights the field in yellow, I can still save a blank field.
Existing Orders: You can save existing orders without entering a Customer PO. However, if you modify the Customer PO field on an existing order, you will then need to enter a PO to save the changes.
New Orders: Entering a Customer PO is required to save new orders. You will not be able to save a new order without it.
Thanks. You are correct that you cannot remove a Custmer PO if one was there, however it still lets me save an order without a PO.
It will continue to allow you to update an existing Order (if you have not touched that field). However, it should not be allowing you to create a new Order and leave the field empty.
I've also hate how this behaves, but it is what it is.
If you want to prevent them from updating existing Orders where the field is still currently empty will require using:
ThisForm.Components("CustPoEdit").ValidateData(True) in a Save event. Cancelling the save event (by returning -1) if the ValidateData method returns false.
If you dirty a bunch of records prior to save (which is always possible), you should be looping through all the records in the collection moving the focus and calling ValidateData for each row. Its not pretty.
Ok, it is working now. My issue was that I didn't make the column on the grid also required. Thanks everyone!
You should try using the event system. Use the IDO On Item Update or IDO on Item Insert events to check if that field is blank and fail if it does. This way, you dont have to worry about your formscript code disappearing during an uplift as the event system is not touched during upgrades.