CRM Crate

How to display a progress indicator or loading screen in Dynamics 365?

We will learn to display a progress indicator or loading screen in Dynamics 365 CRM. Before we start, make sure to subscribe to CRM Crate so that you stay up-to-date in field of Dynamics 365.

How to display a progress indicator or loading screen in Dynamics 365 CRM

Why do we need progress indicators or loading screen in Dynamics 365 CRM?

Consider a scenario where we have to perform an asynchronous or time-consuming synchronous operation on Dynamics 365 form where we want our end user to wait until the operation has executed successfully. We can achieve this requirement by displaying a waiting or loading screen during the interval of the operations, this will prevent the user from updating the form in middle of the operation and provide a better user experience.

Using client side JavaScript for displaying the progress indicator –

Below are the Client APIs used for achieving the in-progress indicator in Dynamics 365 CRM forms.

showProgressIndicator (Client API reference)

Xrm.Utility.showProgressIndicator(message)

closeProgressIndicator (Client API reference)

Xrm.Utility.closeProgressIndicator()

The showProgressIndicator (Client API reference) is used to initiate or start the progress indicator screen, we can display any custom string message within the API’s parameter.

The closeProgressIndicator (Client API reference) is used to terminate or stop the previously started progress indicator.

JavaScript Snippet Code –

The below JavaScript function has been called during the “OnClick” event of the form ribbon button. The progress indicator starts on the exeuction of the function and stops after 5 seconds of execution due to the explicitly added timeout as shown below.

//CRM Crate - JavaScript Snippet
function CallMethod (executionContext) {
var formContext = executionContext;

//Start The Progress Indicator.
Xrm.Utility.showProgressIndicator("CRM Crate Progress Indicator");

//Delay Of 5 Seconds.
 setTimeout(function(){ 
 
 //Stopping The Progress Indicator.
Xrm.Utility.closeProgressIndicator();
		}, 5000);
}
Dynamics form before the progress indicator screen.
Progress indicator has been started after click the ribbon button “Generate Document”.
The closeProgressIndicator API has been called after 5 seconds of script execution.
Dynamics 365 form has returned to its normal state after completion of the operation.

Thus we learned to display a progress indicator or loading screen in Dynamics 365 CRM.

4 1 vote
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
error: CRM Crate Security Engine - Disabled Right Click & Selection!

Congratulations!

Well Done,
Welcome to CRM Crate

Stay tuned with us and get all latest updates and learning in Microsoft CRM and related techonologes.