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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.