Tuesday, 6 September 2016

Modify the Delete (Dustbin icon) Button in the CRM Subgrid

Overview

Sometimes we need to modify the Delete button in the CRM Subgrid, example:

1. For preventing users to perform the delete button (but you dont want to just disable it)

2. Call another function or call custom function that needs client site programming (We can do plugin onDelete or onAssociate, but in case you want to show it in the client site)

3. To do impersonation

The Code

function modifyRibbon() {
    modifySubgridDeleteButtonEventHandler("subgrid_name_in_the_form", deleteSubgridRecord, true);
    discountStructureControl();
}

function deleteSubgridRecord() {
    alert("test");
}

function modifySubgridDeleteButtonEventHandler(subgridName, functionToCall, passGridControl) {
    try {
        //to store the original function ones
        var originalFunctionDeleteRecordSubgrid = Mscrm.GridCommandActions.deleteRecords;
        debugger;
        //add new standard subgrid
        Mscrm.GridCommandActions.deleteRecords = function (selectedControl, selectedControlSelectedItemReferences, selectedEntityTypeCode) {
            //if (typeof (gridControl.get_id).toString().toLowerCase() == "undefined") {} //no need since I replaced by the previous line
            if (selectedControl.get_id() != subgridName) {
                originalFunctionDeleteRecordSubgrid(selectedControl, selectedControlSelectedItemReferences, selectedEntityTypeCode);
            }
            else {
                if (passGridControl) {
                    functionToCall(selectedControl);
                }
                else {
                    functionToCall();
                }
            }
        }
    }
    catch (e) {

    }
}

Result

*After clicking the ‘Delete’ button

image

Note: This method is overwriting the CRM functions and it works for CRM 2013, for CRM 2015/2016, this function [Mscrm.GridCommandActions.deleteRecords] might have been changed, so need to find out the current function name based on your CRM Version. And again, it means it is unsupported Smile

Thanks!

20 comments:

  1. It is very helpful to each one. your point of view is the best among many. thanks for posting.I found your blog the most informative one .thanks for providing it as it helped me a lot in grooming my knowledge.On the off chance that you need a noteworthy impact in your neighborhood, publicizing can raise your association's profile and pass on results. Ad spot advertisements put your message specifically before your potential customers. OOH Advertisement ERP is not just about tremendous sheets for the road. There are distribution goals and sizes to suit every single monetary arrangement.

    ReplyDelete
  2. Your blog post is very informative and helpful one. I learned useful information about how to modify the Delete button in the CRM Subgrid.I am Ms Dynamic CRM consultant and its really very helpful information for me.

    ReplyDelete
  3. Nice article really informative for me as on this I’ve found some best results for
    SuiteCRM Customization
    As this found the best services for crm integration
    SugarCRM integration Services
    CRM Integration

    ReplyDelete
  4. Hi,

    Many thnaks for your article. It works fine on 1:N relationship, but on N:N it doesn't work, do you know why ?

    Thanks,
    Sebastien

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete

  6. بسم الله الرحمن الرحيم عميلنا العزيز نحن نقدم افضل خدمات تنظيف المجالس والشقق بافضل انواع التنظيفات المشهود لها عالميا
    شركة تنظيف مجالس بالطائف
    شركة تنظيف مجالس بجازان
    شركة تنظيف مجالس بحائل
    ونحن فى خماتكم 24 ساعة على مدار الشهر

    ReplyDelete
  7. THANK YOU FOR THE INFORMATION .HI GUYS IF SEARCHING FOR CRM Solutions PLEASE VISIT US
    CMR Solutions

    ReplyDelete

  8. The blog was absolutely fantastic! Lot of great information which can be helpful in some or the other way. Keep updating the blog. We are top CRM Software.

    ReplyDelete
  9. Thanks for great information you write it very clean. I am very lucky to get this tips from you.
    https://blog.mindvalley.com/midbrain-function

    ReplyDelete
  10. Nice information on here, I would like to share with you all my experience trying to get a loan to expand my Clothing Business here in Malaysia. It was really hard on my business going down due to my little short time illness then when I got heal I needed a fund to set it up again for me to begin so I came across Mr Benjamin a loan consultant officer at Le_Meridian Funding Service He asked me of my business project and I told him i already owned One and i just needed loan of 200,000.00 USD he gave me form to fill and I did also he asked me of my Valid ID in few days They did the transfer and my loan was granted. I really want to appreciate there effort also try to get this to anyone looking for business loan or other financial issues to Contact Le_Meridian Funding Service On Email: lfdsloans@lemeridianfds.com / lfdsloans@outlook.com He also available on WhatsApp Contact:+1-9893943740.

    ReplyDelete
  11. Very informative blog about CRM. Thanks for enhancing our knowledge about CRM. Are you looking to improve customer satisfaction levels through our Microsoft Dynamics CRM? Talk to our CRM experts to know what features you can use to make your CRM process more efficient and ultimately boost your productivity.

    ReplyDelete
  12. Look at the way my colleague Wesley Virgin's report launches with this SHOCKING and controversial video.

    You see, Wesley was in the military-and soon after leaving-he revealed hidden, "MIND CONTROL" secrets that the government and others used to get everything they want.

    These are the EXACT same SECRETS lots of celebrities (especially those who "became famous out of nothing") and elite business people used to become wealthy and successful.

    You probably know how you use only 10% of your brain.

    That's mostly because the majority of your brain's power is UNCONSCIOUS.

    Maybe that thought has even occurred INSIDE OF YOUR very own head... as it did in my good friend Wesley Virgin's head about seven years back, while riding a non-registered, trash bucket of a car without a license and on his debit card.

    "I'm absolutely frustrated with going through life paycheck to paycheck! When will I finally succeed?"

    You took part in those thoughts, isn't it right?

    Your success story is going to happen. Go and take a leap of faith in YOURSELF.

    Learn How To Become A MILLIONAIRE Fast

    ReplyDelete
  13. Thanks for sharing this informative content , Great work
    Read this blog to know about : Definition of done

    ReplyDelete
  14. I have a similar interest this is my page read everything carefully and let me know what you think. Satta king game

    ReplyDelete
  15. تتعامل مع شركة ستار وود اكبر  شركة اثاث مكتبي في مصر تتميز الشركة ببيع اثاث مكتبي عالي الجودة .

    ReplyDelete
  16. We customizing erp software in Chennai.Thanks for sharing this infomation.

    ReplyDelete

My Name is..