We (should) all know that when creating an Extender window, we can set fields on the new window to be required.
Notice in the Extender window IV_TRX above, I have made the Field 1, Short Note, to be required.
During entry to this Extender window, if the record is attempted to be saved without that field being entered, we get the standard error:
Not all required fields have been entered.
So that works as expected and intended.
But recently a customer requested a bit of a twist on this requirement.
While we can force the user to enter our required data in Extender, we cannot force them to open the window and enter in data.
Meaning that I can enter the GP record (an Inventory Adjustment record in this example) without having to enter Extender data.
Out of the box, Extender will not do this. That does make sense since we can hook an Extender window onto most any GP window so there isn’t a way to make this work in a generic sense. So can we make this happen?
Yes, it is possible after a fashion with a few caveats.
- We need to write code so that we have to be on Extender Enterprise
- We can’t trap all of the possible events so the solution will be more of a “try to catch honest mistakes” and not “100% bulletproof”
The reason that this solution won’t be 100% bulletproof is that while Extender Enterprise gives users a development solution, it isn’t a substitute for a full Dexterity developer environment.
Working with core Extender Enterprise functionality, the only way that we can accomplish our goal is to write a new Extender Action.
To do so, go into the Extender Solution and choose Actions.
For our action, we can code it so that if the user presses the Save button, we will run our validation script. If that fails validation, then cancel our save.
The not “100% bulletproof” solution is that if the user tries to browse to the next record and gets the “Do you want to save this document?, we cannot catch this message and so our logic will not run.
Creating the Action, we set it up as below:
Choose the Add button and “Run Dynamics GP script”
The name of the script can be anything – however I have chosen a descriptive name that tells me what the script is going to do.
Also note the Product select – Microsoft Dynamics GP.
This Product was selected because the window being referenced (Item Transaction Entry) is a Dynamics GP window.
The code isn’t very complex however if you don’t know a little about Dexterity then you might wonder what it is doing. I’ve included comments in the code to highlight the areas and functionality.
I’ve included the script in the zip file that contains the window, action, and the script itself for reference here.
The highlights of the script are:
- Pull the Extender key values from the GP UI
- Call GetRecordFromJoinedKeys() function to find the Record ID of the Extender record
- If the Record ID is 0, then the data was not entered
- If the data was not entered, give a message to the user. Move focus away from the “Save button” so that GP will not save the GP record
After creating the Action, logging out of GP and then coming back in to enable the new Action, we see that the new Action works as expected.
To implement this on your Extender Enterprise 2013 System.
- Download the xml file that contains the Window and Action
- Import this using the Extender | Import Menu
- Exit GP
- Log into GP and company again to activate the action
If you have any questions regarding this blog you may leave Pat a comment below!