
Form Control provides a “No Code/Low Code” Customization tool for Microsoft Dynamics GP that can revolutionize how users, consultants and developers can make changes to the GP windows work. It was added as a new module to GP Power Tools with the release of Build 31.
This is the fourth article in a series of four articles. The series provides an introduction to Form Control, why it was created, how it works and what it is capable of doing. I will describe how the initial example of making Maintenance windows Read Only was configured. Then I will provide details of some extensions that can be added. The final article has downloadable sample projects for both Customer and Vendor Maintenance.
This article follows on from Part 2 and Part 3 and explains how to add extra protection to block saving and deleting of records. This can be used in conjunction with locking fields to provide extra protection, or instead of locking fields to allow data to be copied to the clipboard.
Adding Extra Save and Delete protection
So far, Form Control has been used to make all the fields not editable by locking them. If you cannot change the fields and the Save and Delete Buttons have been locked then, in theory, you should never come across a situation where the window will think anything as been changed and you cannot manually save or delete.
However, if a change could somehow be made to the window, maybe by a third party product or customization, or if the Save or Delete buttons were somehow enabled, then there is currently nothing to stop the save or delete from happening. Remember that if a form thinks there have been changes, when you close it, or use the browse buttons or lookup to pull up a different record, it will offer to save.
To ensure that the record cannot be saved even if this edge case somehow occurs, let’s use Form Control to block the window from saving or deleting in addition to locking the fields. We will also add a label to place a space between the original rules and the new rules we are adding
- From the Form Control Setup window with the Form Control ID displayed, click the Add button (plus symbol) and select Label. Click OK to save a blank label.
- Use the Control Mode drop down list to select “Block Window from Saving” and respond “Yes” to the confirmation dialog. This will add the rules to prevent saving but does not have any form level resource filtering.
- Click the Add button (plus symbol) and select Label. Click OK to save a blank label.
- Use the Control Mode drop down list to select “Block Window from Deleting” and respond “Yes” to the confirmation dialog. This will add the rules to prevent deleting but does not have any form level resource filtering.
As mentioned above, the new rules added with the Custom Control Modes for Blocking Saving and Blocking Deleting do not have any form level resource filtering. This means they will be controlled by the Base Settings form level filter only. This is currently set to any form beginning with RM_Customer, according to Resource Information this includes 6 forms.
To ensure that these new rules are only applied to the RM_Customer_Maintenance and RM_Customer_Address forms. First, we will adjust the Resource Filter on the Base Settings rule.
- From the Form Control Setup window with the Form Control ID displayed, expand the Base Settings rule and double click on the resource filter to open the Form Control Setup Resources window.
- Check the Allow Multiple Resources checkbox as we will be including more than one resource at the same level.
- Change the Form Name as “RM_Customer_Maintenance”, then edit the Form Mode to Exact and click OK.
Next, we will add a new resource filter for the RM_Customer_Address form.
- From the Form Control Setup window with the Form Control ID displayed, select the Base Settings rule and click Add and select Resource to open the Form Control Setup Resources window.
- Check the Allow Multiple Resources checkbox as we will be including more than one resource at the same level.
- Change the Form Mode to Exact and enter the Form Name as “RM_Customer_Address” and click OK to add the Resource Filter.
- Click Save or press Ctrl-S to save the changes on the Form Control ID.
Note: If you want to allow copying data to the clipboard, you can disable the Lock Field rules now and just rely on the rules to block saving and deleting. You could also add a Disable Field rule to disable the Save Button and Delete Button to make it more obvious that they are not available.
Downloading and Installing
Download the example settings, import using the Project Setup window (without any project showing, select the path to the xml file and click Import):
- GP Power Tools Settings Form Control Customer.dbg.zip
- GP Power Tools Settings Form Control Vendor.dbg.zip
The Form Controls will be active immediately when the affected windows are next opened.
More Information
Here are the articles in this series, they will be available after the publishing date:
- 13-Sep-2024: #GPPT Form Control Introduction – Making Maintenance windows Read Only – Part 1
- 16-Sep-2024: #GPPT Form Control Introduction – Making Maintenance windows Read Only – Part 2
- 17-Sep-2024: #GPPT Form Control Introduction – Making Maintenance windows Read Only – Part 3
- 18-Sep-2024: #GPPT Form Control Introduction – Making Maintenance windows Read Only – Part 4
For more information see:
- GP Power Tools Portal: http://winthropdc.com/GPPT
- GP Power Tools Samples: http://winthropdc.com/GPPT/Samples
- GP Power Tools Videos: http://winthropdc.com/GPPT/Videos
Hope you find this example useful.
David
This article was originally posted on http://www.winthropdc.com/blog.




