The Support Debugging Tool uses a trigger after the Add_Successful_Login_Record global procedure (see more information below) to start its initialization after a user has logged in. Part of this process is starting triggers marked to Automatically Start on Login.
So the question is: What event can I trigger on that happens AFTER the triggers are initialized so that I can run my SDT created trigger when a user logs in?
Well, I had to answer this question myself recently as I wanted to run some code to compare the SQL User ID used to log into Microsoft Dynamics GP with the Windows User ID currently in use on the machine. The site in question created the SQL User IDs to match the Windows User IDs and this script was meant to detect when users logged into Microsoft Dynamics using a different Dynamics User ID to their Windows User ID.
The solution is use a procedure trigger on the global procedure SQM_StartForApp. This procedure is called just after the Add_Successful_Login_Record global procedure.
Below is the script I used for the User ID example. This runs as a non-logging trigger in the context of the Microsoft Dynamics GP dictionary:
NOTE: This code obtains the Windows User ID by calling the GetUserName() function in the Support Debugging Tool dictionary (5261) using some passthrough sanScript and the execute() function.
You can also import the Debugger Settings Login Check.dbg.xml Support Debugging Tool Configuration Settings file which is attached to the bottom of this post.
For more information see
- Running Dexterity scripts after Login or before Logout
- Support Debugging Tool Portal or https://aka.ms/SDT
Hope this is useful.
// Copyright © Microsoft Corporation. All Rights Reserved.
// This code released under the terms of the
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)