Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Set Notification during onclick events inorder to prevent multiple clicking on crm ribbon buttons

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

I have created a custom Button named Create Account, where new account record gets created when Create Account button is clicked. 

But, when the Create Account button is clicked, it takes few seconds to create an account record, due to which the client may get confused as

it takes time and lead to the multiple clicks. 

So, I want to create a notification named "Creating Account.... (Loading symbol -> optional) ",when this button is clicked. So, after this

notification occurs, the action of the Custom button Create Account should be called.

Can you share with your ideas regarding this? 

Need your valid suggestions.!

*This post is locked for comments

  • Verified answer
    Yadnyesh Kuvalekar Profile Picture
    Yadnyesh Kuvalekar 4,102 on at
    RE: Set Notification during onclick events inorder to prevent multiple clicking on crm ribbon buttons

    Hi Meiyappan,

    If you look at the code I posted earlier in the thread, I had created a form notification counter while setting the notification and which I had passed it to clear notification method while removing the same. You will have to do the same as Shantnu suggested.

    Also, request you to mark applicable answers as verified.

  • Verified answer
    Shantnu Sharma Profile Picture
    Shantnu Sharma 655 on at
    RE: Set Notification during onclick events inorder to prevent multiple clicking on crm ribbon buttons

    Hello Meiyappan - When we create a notification, we must provide a uniqueid to it. So, once we remove it, we pass the uniqueid and remove it.Xrm.Page.ui.clearFormNotification(uniqueid).

    When you set the form notification, specify this ID.

    Xrm.Page.ui.setFormNotification(message, level, uniqueId);

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set Notification during onclick events inorder to prevent multiple clicking on crm ribbon buttons

    Hi Shantnu Sharma,

    The form notification works. But, I tried to clear the form notification after an alert is generated. However, the form notification does not get cleared at all.

    Code:  Xrm.Page.ui.clearFormNotification();

  • Suggested answer
    Yadnyesh Kuvalekar Profile Picture
    Yadnyesh Kuvalekar 4,102 on at
    RE: Set Notification during onclick events inorder to prevent multiple clicking on crm ribbon buttons

    Hi,

    That code was just sample code I used in CRM 2016 online environment.

    You will have to refer it to set form notification in your JavaScript code.

  • Suggested answer
    Shantnu Sharma Profile Picture
    Shantnu Sharma 655 on at
    RE: Set Notification during onclick events inorder to prevent multiple clicking on crm ribbon buttons

    Hi - What we do is instead of using a loading panel, we use CRM Form Notifications. This is easy and user can be trained for it. Doesn't take much load as well. Start the notification on click like "Creating Account....." and remove once it is done. It makes no sense to incorporate additional code just for such requirements (to me at least). If you can train users for it and they are happy to see it. This should be okay.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set Notification during onclick events inorder to prevent multiple clicking on crm ribbon buttons

    The code line ODRFForm.oConstants = {}; is not getting recognized. The line is not getting recognized in the dot operator. I am unable to use this piece of code. Is it 2011 version CRM java script code?

  • Suggested answer
    Yadnyesh Kuvalekar Profile Picture
    Yadnyesh Kuvalekar 4,102 on at
    RE: Set Notification during onclick events inorder to prevent multiple clicking on crm ribbon buttons

    Hi Meiyappan,

    I have implemented below in one of my project. Hope it helps you.

    var oDRFForm.oConstants = {};
    
    oDRFForm.reviseDRF = function () {
        "use strict";
        var entityId = Xrm.Page.data.entity.getId();
        if (!entityId) {
            return;
        }
        entityId = entityId.replace("{", "").replace("}", "");
        oDRFForm.oConstants.sFormNotificationCounter = "'" + Math.floor((Math.random() * 1000) + 1) + "'";
        Xrm.Page.ui.setFormNotification("Kindly do not refresh the page. System is revising this document request. You will receive a message once completed.", "INFO", oDRFForm.oConstants.sFormNotificationCounter);
        //call your action
    };
    
    oDRFForm.reviseDRFSuccessCallback = function (oResult) {
        "use strict";
        Xrm.Page.ui.clearFormNotification(oDRFForm.oConstants.sFormNotificationCounter);
        if (oResult.cf_documentrequestformid) {
            Xrm.Utility.alertDialog("Document request revised successfully. Click OK to navigate to the record.", function () {
                oCommonCrmMethods.openEntityForm(oDRFForm.oConstants.sDRFEntityLogicalName, oResult.cf_documentrequestformid);
            });
        }
    };

    Kindly tick verify answer if this helps you.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set Notification during onclick events inorder to prevent multiple clicking on crm ribbon buttons

    Hi Sohail,

    Thanks for the reply. I have already done that. But, the thing is when I click this button it takes few seconds of time to give the alert as "Account has been created" which I have put. During this period of time, user tries to perform multiple clicking in order to perform the function. This is when, I need to set a notification.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set Notification during onclick events inorder to prevent multiple clicking on crm ribbon buttons

    There is another idea may it be work for your scenario.

    using disable button properties.

    Means after click and "Create Account" button alert Message and meanwhile disabled the button.

    so user couldn't click again and again.if button is disabled

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Set Notification during onclick events inorder to prevent multiple clicking on crm ribbon buttons

    I too tried this and debugged ... it doesn't enter in the loop itself

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.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans