#GPPT Setting Default Sorts for Inquiry Windows

David Meego - Click for blog homepageToday, I was asked by a partner how simple it would be to default the Sort by fields on the Payables Transaction Inquiry – Vendor window to Document Date in Descending order. This is previously the type of quick tweak that you might have used VBA (Visual Basic for Application) for.

However, now that VBA is “End of Life” and is not supported on the Web Client and some windows platforms, this is a perfect customization to use the GP Power Tools – Developer Tools module for. The entire customization took me about two minutes to complete. In fact, it took much longer to write this article.

Start by opening the Resource Information window and make sure it is in Form, Window & Field mode and the “Show currently selected Window and Field information” option is selected. Then open the window you want to customize and click on the first field you want to work with.

Payables Inquiry

Come back to the Resource Information window and you will see the full details for the form, window and field, including the Technical Names you will need to write the code.

Resource Information

Open the Project Setup window and create a new project. Projects are used to combine all the parts of a project together to make it easier to develop and maintain as well as export and import. Even though this customization only needs a single trigger, it is still worth creating the project record.

Note: Enter the form name into the Open Form field, this makes it easy to test the customization as you can quickly navigate to the first window needed to test your customization.

Defaulting Project

Click the Add button and select Trigger Setup to open the Trigger Setup window. Enter a Trigger ID and Description and set the trigger to start automatically, do not activate logging and to minimize log entries.

The next step is to set the trigger type and resource to a Focus Event, on Window Pre running After Original code. Then, on the Resource Tab, you can select the resource using the Form Name and Window Name from the Resource Information window. You can also use the menu lookup or the dictionary lookup to select the window.

Defaulting Trigger 1

Click over to the Script Tab and add the 4 lines of code needed to change the value of the two drop down list fields and run the change scripts for the fields.

You can click on the second field to show its name in the Resource Information window. You can also select the fields using the Names Button.

Note: When referencing the fields, the “of window PM_Transaction_Inquiry of form PM_Transaction_Inquiry” full qualification is optional because the default form to and default window to commands are setting the context for the script to that form and window.

Defaulting Trigger 2

The code lines added above the OUT_Condition = true; line are:

'PM Sort By' = 5;
run script 'PM Sort By';
'Sort Order' = 2;
run script 'Sort Order';

Note: The Out_Condition parameter can be used to specify if the script successfully completed or if an error condition has been found. It controls whether the actions on the Actions Tab (if any are selected) are executed after the script has completed.

To test the code, following the steps below:

  • Close the Payables Transaction Inquiry – Vendor window (if it is open).
  • From the Project Setup window, click Start >> Project Triggers.
  • Click on the Open Form hyperlink to open the window.
  • Check that the fields have defaulted as desired.

Note: The Resource Information window and Resource Finder window are part of GP Power Tools – Administrator Tools module, which is just another reason why every customer site should have the Administrator Tools.

Download the project here:



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

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 )

Google photo

You are commenting using your Google 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.