#GPPT Stopping Vendor ID Auto Populating on Payables Transaction Window

David Meego - Click for blog homepageA while back there was a forum post on the Community Forum asking how to stop the Vendor ID from automatically populating with the previously entered Vendor ID when entering Payables Transactions.

This functionality can be useful when entering multiple transactions from a single vendor, but can also cause data entry errors if entering a transaction from a different vendor and the ‘Vendor ID’ is not changed.

At first glance I thought it would simply be caused by the ‘Vendor ID’ field on the window having the object property of SavedOnRestart=True. However, that was not the case.

If it had been the SavedOnRestart=True on the ‘Vendor ID’ field, the ‘Vendor ID’ field would still show the previous value after the transaction was saved or deleted and the form restarted, but it does get cleared.

After some further testing, I found that the ‘Vendor ID’ field is repopulated with the previous Vendor ID value when tabbing into or clicking on the ‘Vendor ID’ field. This lead me to check the source code for the ‘Vendor ID’ field’s Pre script and identify that the ‘Vendor ID’ field is populated when entering a new transaction using a previously stored Vendor ID value from the local field ‘(L) Prev Vendor ID’.

It is this ‘(L) Prev Vendor ID’ local field which has the object property of SavedOnRestart=True which allows it to keep the previous Vendor ID value when the form is restarted. The previous value gets stored in this local field when saving a new transaction.

Now that we understand how the feature functions, we can make changes to “break” the feature and stop it auto populating. Below are two solutions you can use:

GP Power Tools Trigger Solution

Using GP Power ToolsDeveloper Tools module we can add a trigger before the ‘Vendor ID’ field pre script to clear the ‘(L) Prev Vendor ID’ local field.

While this customization only required a single trigger, it is always best to use a project as this allows the trigger to be easily imported and exported. When there is more than one object needed for a customization the value of grouping them all into a single project increases.

Here are the steps to create this solution:

  1. Open Project Setup window (GP Power Tools >> Cards >> Project Setup).
  2. Enter the Project ID as PM_NOAUTOVEND.
  3. Enter the Project Description as Payables Transaction stop Vendor ID auto populating.
  4. Optionally, mark the Current Project checkbox if you want this project to load when you open the Project Setup window.
  5. Enter the name of the form you want to use when testing the project. Product: 0: Microsoft Dynamics GP, Form: PM_Transaction_Entry.
  6. Click Add >> Trigger Setup to open the Trigger Setup window.
  7. Enter the Trigger ID as PM_NOAUTOVEND.
  8. Enter the Trigger Description as Payables Transaction stop Vendor ID auto populating.
  9. Make sure the 3 checkboxes on the right hand side are selected. This makes sure the trigger starts automatically, that we don’t start additional logging and that we don’t write any log entries unless there is a problem with our code.
  10. Select Trigger Type: Focus Event, Trigger Event: Field Pre and Trigger Attach: Before Original.
  11. On the Resource tab, enter or use the Menu Lookup button (or Dictionary Lookup Button) to select Product Name: 0: Microsoft Dynamics GP, Form Name: PM_Transaction_Entry, Window Name: PM_Transaction_Entry and Field Name: Vendor ID.
  12. On the Script tab, edit the default script to remove the “if not empty(” line and matching “end if;”. Then enter the command “clear” and use the Names >> Forms, Windows & Fields button to select the ‘(L) Prev Vendor ID’ of window ‘PM_Transaction_Entry’ of form ‘PM_Transaction_Entry’ field and finish the line with a semicolon.
    in string IN_Value;
    out boolean OUT_Condition;
    OUT_Condition = false;
    if isopen(form PM_Transaction_Entry) then
    	clear '(L) Prev Vendor ID' of window 'PM_Transaction_Entry' of form 'PM_Transaction_Entry';
    	OUT_Condition = true;
    end if;
  13. No changes are required for the Actions or Options tabs.
  14. Click Save and close the Trigger Setup window.

To Test, on the Project Setup window, click Start >> Project Triggers, then click on the Open Form hyperlink to open the Payables Transaction Entry window.

The customization will be active for users next time they log into GP or switch company, assuming that GP Power Tools is installed on every workstation and server where GP is installed as per the recommended configuration. No additional deployment steps are required.

Note: No security changes are required as we have not changed any window layouts.

Downloading and Installing

Download the example code, import using the Project Setup window (now possible for first time imports with Build 28.8 onwards), or use Configuration Export/Import window (for older builds):

The code will be active on next login or after switching companies, or you can use start the triggers manually from the Project Setup window.

More free customizations on the GP Power Tools Samples page:

Modifier Solution

Using the Modifier we can change the object property SavedOnRestart=False on the ‘(L) Prev Vendor ID’ local field which stops the previous Vendor ID from being saved when the form is restarted.

Here are the steps to create this solution:

  1. Open the Payables Transaction Entry window ( Purchasing >> Transactions >> Transaction Entry)
  2. Go to the Modifier for this window (Tools menu >> Customize >> Modify Current Window)
  3. Display the Invisible Fields (if not displayed already) (Layout menu >> Show Invisible Fields)
  4. Scroll down in the layout window to show the five columns of pink hidden fields.
  5. On the fourth column from the left, second row you will find the ‘(L) Enable Intrastat’ field.
  6. This field is covering up the field we need to change, so drag and drop it up into the blank spot underneath the yellow ‘Open Attachment Management'[1] field.
  7. Now the ‘(L) Prev Vendor ID’ field is visible. Click on it to select it.
  8. From the Layout Menu >> Properties or press Ctrl-M. If the window appears and disappears, place your mouse where it appeared and press Ctrl-M again.
  9. In the Properties window, select Object Tab.
  10. Locate SavedOnRestart property and double click on it to change to False.
  11. Close the Layout window and respond Save when asked.
  12. Click OK on Form Definition window to close it.
  13. Return to Microsoft Dynamics GP (File menu >> Microsoft Dynamics GP)
  14. If you are not using a shared Forms.dic custom forms dictionary, you will need to export the customization Maintenance Package file and import it onto each workstation.
  15. Use Alternate Modified ID setup window (Administration >> Setup >> System >> Alternate/Modified Forms and Reports) to change security to the now modified window.

Downloading and Installing

Download the package file below and import using the Customization Maintenance window (Microsoft Dynamics GP >> Tools >> Customize >> Customization Maintenance).

Note: Using the Modifier Solution, you must make sure you modify the correct version of the window if using an alternate version of the window from a third party product AND you must change the Modified Alternate Forms and Reports ID to point to the now modified form.

Hope you find this helpful.


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

One thought on “#GPPT Stopping Vendor ID Auto Populating on Payables Transaction Window

Please post feedback or comments

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.