DynDeveloper.com

DynDeveloper.com

Sign Up Now! Log In
steve gray 8/9/2011 7:27:27 AM

Make A Custom Field Required

Applies to: GP9, 10, 2010 

It happens that you need to add a field using modifier to a form, and that field needs to be a required field. There are a host of issues with this, the biggest one is that Dynamics GP doesn't provide you with a hook in the 'save' process to stop a save from happening

The user can save by pressing the Save button, or by navigating using the 'VCR' buttons in the bottom left corner of the form, or by pressing the Print button. Pressing Save will save with no warning, pressing the other 5 buttons will cause a modal dialog to pop up that will prompt the user to Save, Delete, or Cancel.

In order to make a field required, we'll need to do two things - put code in the Save_BeforeUserChanged event, and in the Window_BeforeModalDialog event.

The Save event is simpler. In these examples, our custom field is called Barcode. We're in the Payables Transaction Entry form, so we'll check to see if some of the other required fields are filled in. If they are, we'll stop the save by setting CancelLogic = True

Version: All
Section: VBA