Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking if alternate windows in use

Dexterity Techniques

Checking if alternate windows in use

by  winthropdc  Posted    (Edited  )
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;
else
if IMIntegrationMode of globals then
{ Integration Manager is running }
else
{ 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
http://www.microsoft.com/BusinessSolutions

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.

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top