Logo
banner

Blogs

Microsoft Dynamics 365 v9.0 – Show Progress Indicator

, January 11, 2018 2610 Views

With the release of Dynamics 365 v9.0, lots of new features & updates has come which will increase the ease and efficiency of the work of CRM Developers.

Today, I will share some knowledge on how to use the showProgressIndicator function of the Xrm.Utility namespace.

Many a times, CRM takes some more time to execute a function, may be on save event of form or on a button click event or on change event of a control etc.

This could be either because of the JavaScript logic that you have built on an event may be little complex that it is taking more time or there might be long API calls/ or CRUD operations in the background or any business processes, which are taking too much time in giving the results.

Till now there wasn’t a proper out-of-the-box way to indicate the user that some background process is going on, and the user must be prevented from making any changes.

But, with the release of D365 V9, the Xrm.Utility has a new JavaScript function ‘showProgressIndicator’, which will show a modal dialogue / popup to the user, and the user will not be able to access the form until the popup is closed.

Note:-  This popup will not be having any button on it. You need to close the popup using the closeProgressIndicator function of the Xrm.Utility namespace.

Here is a simple JavaScript code to populate the Fax number on the Account form on OnChange event of Phone number field.

// JavaScript source code
function setFaxNumber()
{
    Xrm.Utility.showProgressIndicator("Loading fax number..");

    // Here, I have used setTimeout, to ensure that the progress indicator shows up for at least a few
    // seconds, as setting the fax number doesn't take much time.
    setTimeout(setFaxNumberafterdelay, 3000);
}

function setFaxNumberAfterDelay()
{
    var phoneNumber = Xrm.Page.getAttribute("telephone1").getValue();
    if (phoneNumber != null) {
        Xrm.Page.getAttribute("fax").setValue(phoneNumber);
    }
    Xrm.Utility.closeProgressIndicator();
}

The ‘Xrm.Utility.showProgressIndicator(“Loading fax number..”);’ will show a popup as below:-

The setFaxNumberAfterDelay function will set the fax number on the Account form and the Xrm.Utility.closeProgressIndicator() within it, will close the popup that was opened by the showProgressIndicator function.

The showProgressIndicator & the closeProgressIndicator functions of the Xrm.Utility namespace are really very helpful, when you need to indicate the user that some background processes are going on and for preventing the user from making any changes in the form at that time.

I Hope this helps you…

Happy CRMing!!


 

Insert data into Many-to-Many relationship in Dynamics CRM very easily & quickly, using the Drag and drop listbox.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/drag-and-drop-listbox

mm

Inkey

INKEY is your solution partner.
Our focus is to deliver you in-time intelligent innovative solutions ("key") for the problems in hand. Maintaining a quality standard right from the inception of a project is our top most priority.

Our team of talented professionals will execute your projects with dedication and excellence. We take ownership and accountability for the effort that goes into meeting our client’s needs.

Years of experience and proven success of delivering innovative custom solutions.

More posts by

Leave a Reply

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