Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Dexterity Techniques

Checking if alternate windows in use by winthropdc
Posted: 25 Oct 04 (Edited 5 Jul 05)

Checking if alternate windows in use

Below is the full method of checking that your alternate window is in use before executing your trigger code.  This will prevent illegal address errors if your alternate is not in use.

I would suggest creating a global function which you can call from any where to check if your alternate form is in use.

{ Function: Check_Security_Alternate }

{ Check if Form Security is pointing to the Alternate window }

function returns boolean OUT_Alternate;
in 'Resname' l_resname;

OUT_Alternate = false;
if Runtime_GetCurrentProductID() = DYNAMICS then
    { In Test Mode }
    OUT_Alternate = true;
    if IMIntegrationMode of globals then
        { Integration Manager is running }
        { Runtime Mode }
        set 'Company ID' of table SY_Security_Normal_MSTR to 'Company ID' of globals;
        set 'User ID' of table SY_Security_Normal_MSTR to 'User ID' of globals;
        set 'DictID' of table SY_Security_Normal_MSTR to DYNAMICS;
        set 'Restype' of table SY_Security_Normal_MSTR to FORMTYPE;
        set 'Resid' of table SY_Security_Normal_MSTR to  Resource_GetID(DYNAMICS, FORMTYPE, l_resname);
        get table SY_Security_Normal_MSTR;
        if err() <> MISSING then
            if AltDictID of table SY_Security_Normal_MSTR = Runtime_GetCurrentProductID() then
                OUT_Alternate = true;
            end if;
        end if;         
    end if;
end if;

Now create a Global boolean variable for each alternate window you have. Place Before FORM_PRE triggers on all forms based on the example below.

{ FORM PRE trigger }
'FormName Alternate' of globals = Check_Security_Alternate(technicalname(form FormName));

Then in all your trigger scripts for the alternate window add the following at the top.

if not 'FormName Alternate' of globals then
    abort script;
end if;

David Musgrave [MSFT]
Senior Development Consultant
MBS Services - Asia Pacific

Microsoft Business Solutions

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties,
and confers no rights.  

Back to Microsoft: Dynamics GP (Great Plains) FAQ Index
Back to Microsoft: Dynamics GP (Great Plains) Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close