CRM 2011 Ajax Loading Message Screen with JQuery

When you use ajax request in CRM2011 (for example, the OData call), the user is not notified when this process happens in the background. Although this call is relatively fast, sometimes you can't predict the performance of it and you want some kind of notification that lets the user know what's happening.

Fortunately with the power of JQuery you can easily make this happen. In my case, I have a custom 'Create Opportunity' button on my custom entity form that gets the data from that entity (and related entity) and create opportunity with those data.

When creating the opportunity using the OData way, I will show the loading message popup with the animated OOTB CRM progress gif image.


To make this happen, it's simple. Just put this function into your onLoad form:



You notice the center() method above. This is an add-on to the jQuery method that you can safely put on your jQuery file:



That's it. Now whenever there is an Ajax call on the form, you will get this message shown up.

Hope this helps,
Andreas

Comments

  1. Hi,

    Great Blog. I need a similar concept for mine too.

    There is a custom entity form where on Save there are some workflows getting triggred in the background to populate some fields in the same form.

    For which i need on click of save button it should do save then a gif loading image for 10sec and finally refresh the page.

    Can you help me with this, Please.

    Rahul
    rahulth@gmail.com

    ReplyDelete
    Replies
    1. Is this CRM workflow or custom code you are talking about? is it triggered from Javascript?

      If it is a custom code or a call to webservice, you can just the above approach. You can just use jQuery to show or hide image as you wish when the call is being executed.

      Regards,
      Andreas

      Delete
  2. i tried to use as you mentioned but i am receiving an error form_onload is undefined

    ReplyDelete
    Replies
    1. 1. Have you include the javascript and jQuery in the web resources and include them in your form?
      2. Have you enabled the form load event JavaScript and specify the 'Form_onload' function as the function to call?

      Delete
  3. i put the center add on in jquery but i am receiving an error object does not support the property or method center please help

    ReplyDelete
    Replies
    1. Did you put it in your jQuery file and re-publish it?

      Delete

Post a Comment

Popular posts from this blog

SharePoint 2013 anonymous access add attachments to list item

CRM Plugin - Parent and Child Pipeline

Sitecore custom publish agent from specific node and at a specific time