Hey readers, today I will tell you a bit about improving the performance of custom AIF services. I was given a task to create a .Net application for a client. The application allowed the user to select a Purchase order based on the company, warehouse and location. The user could update the quantities of a Purchase Order Line.
To achieve this I created a custom AIF service, to get the data and to update the data. Now everything was working well but the application was way too slow. After doing some analysis I decided to change my approach. Since the application is cross company I decided to use CallContext object to set the company instead of setting it manually in every method.
Also at AX level I decided to use the Query framework instead of using X++ queries. This allowed me to handle the “empty value in parameter returns all records” scenario in a single line instead of using “if-else”
After doing all this, the calls through the AIF were improved but still the application was not performing up to the mark. I found out that in the .Net application the event “SelectedIndexChanged” of all controls was being called even when the controls were being initialized at the start of the application. Due to this the application slowing down at start.
What I did was when the application started I removed the events from the controls and then added them back.
After doing so, the event was being fired only after the application had started. This helped the application run faster and smoother than before. These steps helped me improve the performance of my application.
I hope this blog will be useful for you guys. I will be back with more blogs.