When a user clicks OK in the Company Login window in Microsoft Dynamics GP, the user cannot log on to the company. However, a third-party customization is still triggered. For example, if a company is already logged on to, users cannot log on to the company. However, a trigger can unexpectedly access tables in the company database.

Note If you are a developer, you can register the trigger after you change the OK Button script for the Switch Company window of the Switch Company form.


To resolve this problem, use the following global procedures in the script:

  • Add_Successful_Login_Record

  • Add_Successful_Logout_Record

For example, you can use both global procedures in the following script:

pragma(disable warning LiteralStringUsed);
{ Log in and Log out Triggers }
if Trigger_RegisterProcedure(script 'Add_Successful_Login_Record', TRIGGER_AFTER_ORIGINAL, script Set_Environment) <> SY_NOERR then
warning "Log on procedure trigger registration failed.";
end if;
if Trigger_RegisterProcedure(script 'Add_Successful_Logout_Record', TRIGGER_AFTER_ORIGINAL, script Set_Environment_POST) <> SY_NOERR then
warning "Log off procedure trigger registration failed.";
end if;
pragma(enable warning LiteralStringUsed);

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!