I need to triger a function when my page is load completely
readyState === "complete"
How do I do that? should I use event listener ?
would be happy to get an example.
Hi damka,
Did you check the link; https://stackoverflow.com/questions/48259669/how-to-make-sure-load-complete-in-crm-page?
you can use the formContext.data object to check if a page is fully loaded. The formContext.data object has a getIsLoading() method that returns a Boolean value indicating whether or not the page is still loading. Here's an example of how you can use the formContext.getIsLoading() method to check if a page is fully loaded:
var intervalId = setInterval(function(){ if(!formContext.data.getIsLoading()){ // Page is fully loaded clearInterval(intervalId); // Perform additional actions after the page is loaded } }, 1000);
In this example, the setInterval function is used to check the formContext.data.getIsLoading() method every 1 second. Once the page is fully loaded and the getIsLoading() method returns false, the clearInterval function is called to stop the interval and the additional actions that you want to perform after the page is loaded can be implemented.
setInterval
.data.getIsLoading()
getIsLoading()
clearInterval
It's important to note that when you are creating forms or web resources that interact with the form, you should wait for the form to be fully loaded before interacting with the form controls to avoid any errors or unexpected behaviors.
Additionally, Dynamics 365 CRM also fires events when a form is loading, saving, closed and so on, that you can use to check the state of the form and perform specific actions accordingly.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Tom_Gioielli 117 Super User 2025 Season 2
MVP-Daniyal Khaleel 115
Erin Lubben 66