Dynamics 365 (V9): Progress Indicator API

By | October 17, 2017

It has only been a few weeks since I wrote a blog post about Alert.js, but, with the release of V9, we now have the same sort of functionality available out of the box:


As described in the “What’s new for developers” article, there have been some client API enhancements in V9.  In particular, we’ve got two new functions in the Xrm.Utility namespace:

  • showProgressIndicator
  • closeProgressIndicator


You can see how the progress indicator looks like above, and here is the code I used to make it work:

function getPrimaryContactEmail()
    Xrm.Utility.showProgressIndicator("Loading contact email..");
    setTimeout(delayedLoadPrimaryContact, 3000);

function delayedLoadPrimaryContact()
    var contact = Xrm.Page.getAttribute("primarycontactid").getValue();
    if(contact == null){
    Xrm.WebApi.retrieveRecord("contact", contact[0].id, "$select=emailaddress1")
    .then(function(result) {
        var email = result["emailaddress1"];
        alert("Here is the email: "+email);
    .fail(function(error) {
        var message = error.message;
        alert("Error: "+message);


That’s a web resource I added to the account form, and, then, I added getPrimaryContactEmail as an onload event handler.

You may be wondering why there is setTimeout in this code.. it’s, really, just to make sure that progress indicator shows up for at least a few seconds. Retrieving contact email from CRM does not take long enough to notice the indicator otherwise.

That’s an oversimplified example, of course.. but, every now and then, we might need this ability to display a progress indicator to notify Dynamics users that something is happening behind the scene – it might be a ribbon button making a javascript call that is supposed to do some extensive server-side processing. Or it might be a javascript calling  a custom action. Or it might be any other javascript that’s taking at least a few seconds to complete.

Hope you are enjoying V9 so far!

PS. And, by the way, if you are wondering about that Xrm.WebApi.retrieveRecord call.. That’s another addition to the Xrm namespace, but you can read more about it here: Microsoft Dynamics 365 v9.0: Usage of new OOB WebApi functions – Part 1

2 thoughts on “Dynamics 365 (V9): Progress Indicator API

Leave a Reply

Your email address will not be published. Required fields are marked *