Quick Tip: Hidden Forms, Command Forms and Dictionary Context issues

David Meego - Click for blog homepageThis quick tip follows on from my previous post: Quick Tip: Updating Dexterity customizations to work with Security Tasks and Security Roles.

There are times when there is a requirement to have some fields on a hidden form (a form with non of the windows set to AutoOpen).

One example is when you want code to run in the foreground once all the foreground code currently queued up has completed. You don't want to use a procedure running in the background as that could get queue behind other processes or reports. The method of achieving this is using the run script delayed <Field> command to run the change script of a field once all other foreground code has completed. So if you need this functionality but don't have a field on any visible forms that can take your code, you would use a hidden form (and make sure it is excluded from security).

So, here is what this post is about....

If you need a hidden form for your coding, rather than create a new one... use the one you probably already have. If you are integrating with the menu navigation of Microsoft Dynamics GP you will probably already have a Command Form set up with all your commands and menus for your application.  This form is opened on login and remains open at all times. So it is a perfect location to add a hidden window with your fields on it. Don't create new forms that you need to open and close, just use your existing Command Form.

So, the final point of the post is Dictionary Context issues.

Dictionary Context issues are when Dexterity executes code in the context of the wrong dictionary. It used to be common back in the early days of cross dictionary triggers and cross dictionary development. Now it is not so common as the Dexterity Development team have fixed most of the problems. I have not had an issue with Dictionary Context for quite a while now.

The reason I am mentioning it, is that the method to ensure the dictionary context has changed back to your dictionary after a cross dictionary trigger fires is to use run script on a field on a form in your dictionary. But what happens if you don't have any of your forms open, you will need a hidden form for this. And guess what? The Command Form is already there.

So, if you ever get a Dictionary Context issue, you know how to resolve it and where you can place your field.