#GPPT Form Control Working with Customer ID, Vendor ID and Item Number

David Meego - Click for blog homepageGP Power Tools Form Control is a “No Code/Low Code” customization tool for Microsoft Dynamics GP. It can be used to solve many requirements without any coding.

Here are some real-life examples showing how you can quickly use Form Control to control how key fields such as Customer ID, Vendor ID and Item Number are entered into Microsoft Dynamics GP throughout the whole product.

In Microsoft Dynamics GP you are allowed to use almost any character when entering the primary key fields for master records such as Customers, Vendors and Items.

Some characters have been known to cause issues, for example:

  • Single Quote (‘) character can cause issues if the ID field is passed to SQL Scripts without using the SQL_FormatStrings() command that handles the single quotes and prevents early termination of a string and possible SQL Injection risks. Microsoft Dynamics GP handles this situation correctly, but some customizations might not.
  • Back Quote (`) character is used in the Report Writer and its inclusion in key fields can cause issues when printing reports.

It is also possible to have a space as the starting character, if another character is entered first and then deleted.

Using Form Control you can strip unwanted characters (and leading and trailing spaces) from the ID fields to just leave the approved characters.

It is also possible to add formatting and validation to fields as shown with the optional rules for Item Number.

Strip Unwanted Characters from Customer ID

The FORM CONTROL CUST ID Form Control ID is limited by the Base Settings Resource Filters to forms beginning with RM_, SOP_, IVC_, and SVC_ to avoid Form Control processing every form in the entire product looking for Customer Number fields.

The Strip Invalid Field Characters rule is limited to fields ending with Customer Number, which means it will work for Customer Number, Parent Customer Number, Starting Customer Number, Ending Customer Number, etc.

The Expression specifies that numbers, letters, spaces, periods, underscores and dashes are valid characters.

Note: Additional characters can be added to the Expression field, but the dash must be the last character otherwise it will be interpreted as specifying a range of characters.

Strip Unwanted Characters from Vendor ID

The FORM CONTROL VEND ID Form Control ID is limited by the Base Settings Resource Filters to forms beginning with PM_ and POP_ to avoid Form Control processing every form in the entire product looking for Vendor ID fields.

The Strip Invalid Field Characters rule is limited to fields ending with Vendor ID, which means it will work for Vendor ID, Starting Vendor ID, Ending Vendor ID, etc.

The Expression specifies that numbers, letters, spaces, periods, underscores and dashes are valid characters.

Note: Additional characters can be added to the Expression field, but the dash must be the last character otherwise it will be interpreted as specifying a range of characters.

Strip Unwanted Characters from Item Number

The FORM CONTROL ITEM ID Form Control ID is limited by the Base Settings Resource Filters to forms beginning with IV_, SOP_, IVC, SVC_ and POP_ to avoid Form Control processing every form in the entire product looking for Item Number fields.

Note: Labels have been used to add more information to the optional rules which are currently disabled.

The Strip Invalid Field Characters rule is limited to fields ending with Item Number, which means it will work for Item Number, Starting Item Number, Ending Item Number, etc.

The Expression specifies that numbers, letters, spaces, periods, underscores and dashes are valid characters.

Note: Additional characters can be added to the Expression field, but the dash must be the last character otherwise it will be interpreted as specifying a range of characters.

Optional: Formatting Item Number

The optional Format String Field Value rule can be enabled to format Item Numbers to the format XXXX-XXX-XXXX or whatever format is entered into the Expression field.  The extra characters (dashes in this example) will be removed when the focus enters the field and added back once the focus leaves the field. The Warning Message will be displayed if there are not the correct number of characters entered to match the desired format.

Optional: Validating Item Number

The optional Validate Field Value rule can be enabled. The Expression Field is used to describe the list of rules that need to be met. If the rules are not met, the Warning Message is displayed. The rules can be specified as a Regular Expression (RegEx) or using the simpler rules built into Form Control.

Click the Info button to the right of the Expression field to display the help window shown above.

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):

The Form Controls will be active immediately when the affected windows are next opened.

More Information

For an introduction series for Form Control with step-by-step instructions see:

For more information see:

Hope you find these examples useful.

David

This article was originally posted on https://www.winthropdc.com/blog.

Leave a Reply