Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

Trigger on GP Exit

Posted on by 1,500

HI

 I have to write a trigger which has to be run on Exit of Application. I mean when user close the applicaiton or GP , not the form , trigger has to be fired.

 Any idea regarding this.

 Thanks in advance

Wajahat

*This post is locked for comments

  • Wajahat Ali Profile Picture
    Wajahat Ali 1,500 on at
    Re: Trigger on GP Exit

    Hi 

    Thanks for your support. Right now i am using the follwing scenario. "exitDynamics" of form 'Main Menu'   is a procedure which runs on the exit of application and it is GP default procedure . So , now i have inserted the trigger over this. But problem is that trigger is being fired at the right time but i have to run an application and that one is not supported by trigger. I am using the command  " run applicaiton (application name) " through dexterity. Its mean trigger is fired but application is not run or trigger is not able to run the command at this level.

     

     

  • Richard Whaley Profile Picture
    Richard Whaley 25,195 on at
    Re: Re: Trigger on GP Exit

    I have not checked what happens to the Activity table but I would not be surprised if this idea failed.  In many other tables, GP has a habit of adding a record, deleting the record, adding it again, deleting, and then adding.  All in one transaction posting.  I would not be surprised if you did not get a delete on login, especially if you have to delete user id from a crashed session before signing back on again.

     Maybe David will know how to do this correctly.

  • K Day Profile Picture
    K Day 7,365 on at
    Re: Trigger on GP Exit

     I'm pretty sure the last table that is updated when a user logs out of GP is the DYNAMICS..ACTIVITY table.  The trigger might want to be on Delete.  I think the command is something like

    DELETE FROM DYNAMICS..ACTIVITY where USERID = '@userid'

    (and maybe you need a session id involved too, since a user might have more than one client open, SQLSESID is the field.)

     Not sure what happends when they change companies though, it might just be an update statement to change the CMPNYNAM or it might do a delete and then an insert.  If it is a delete, then it is possible that you might get false results.

    Also, if a user has to force GP closed, often that Activity table will not be properly cleared.

    Hopefully this is a start.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans