Delegates to customize Application startup


                            Application Startup Event Manager 



In Dynamics AX 2012, there are some customization points that allowed us to subscribe to event Applications. Startup delegate those were raised when the client was initializing.

But in D365 those events were deprecated and introduce some new events were to customize the application startup as per your requirement.

You can find those events to subscribe to in-class  ApplicationStartupEventManager  



onSystemStartup()

  • This event occurs when the system starts up and Its raised once per AOS startup.

 onFirstTimeUserInteractiveSessionCreated()

  • This event occurs when the system is creating an interactive session for the first time for a user.

 onFirstTimeUserNonInteractiveSessionCreated()

  • This event occurs when the system is creating a non-interactive session for the first time for a user.

onInteractiveSessionCreated()

  • This event occurs when an interactive session is created and ready for use.
  • It is raised once per interactive session creation for any user.

onSessionCreated(boolean _isBatch, boolean _isInteractive)

  • This event occurs when the session is created and ready for use.
  • It is raised once per interactive session creation for any user.
  • _isBatch specifies whether the system is running a batch job.
  • _isInteractive specifies whether the session is interactive.


Let's begin to verify the above delegates

To verify the delegates we will log these events into a table.

Step-1 Create a class and subscribe to the delegate in this demo I have subscribed to only two delegates.

  • onSessionCreated
  • onSystemStartup




Step-2 Create a table and insert anything to verify that events are working or not.




Step-3 Stop the IIS and Batch services.
Step-4 Build & Sync model or project.
Step-5 Verify records on the newly created table using SQL.



Step-6 Restart The IIS services.  On this step systems, startup event will raise Once.

Step-7 Start Batch service. On these steps systems startup event will raise 14 times.  You can check the number of records of SQL is 15


Step-8 Login On D365.  On this step session created event will raise.
Step-9 Verify records on newly created Table using SQL.


Please let me know if you are facing any issues during the implementation of this blog 



 

1 comment:

  1. Thanks for sharing such informative post. Next Disruptor aims to be the perfect technical partner for South African pre-startups to post-launch startups – professional, flexible and fast and, crucially, with your business’ best interests at heart.
    app startup funding

    ReplyDelete

Virtual Fields Vs Computed Fields

  Virtual Field: A virtual field in D365FO is a field that doesn't have a direct representation in the database. It's a field that y...