Sunday 5 July 2015

Create Custom Ribbon in CRM Homepage Gridview

A quick tip for creating ribbon for subgrid

We can use Visual Ribbon Editor or RibbonWorkbench, they are two great tools!

Then, the most important thing is of course calling your Web Resources function.

And do not forget to pass the CRM Parameter : SelectedControlSelectedItemIds

image

Then to get the selected ID, you can use this function:

function acknowledge(selectedIds) {
    //check the status first
    debugger;
    if (selectedIds != null && selectedIds != "") {
        var strIds = selectedIds.toString();
        var arrayIds = strIds.split(",");
        for (var i = 0; i < arrayIds.length; i++) {
                //selected id = arrayIds[i]
            }
        }
    }   
}

To get the value of the selected record, you need to query using the ID using odata or fetchxml

Then you can also show hide, this time, i use my custom rule:


image

Or you can use your own rule or available CRM Rules, but you cannot use valueRule as I know since this only take the value rule from formCommand context.

Then here is the result:

image

If you want to validate that only if selected then show the ribbon, you can use another Enable Rule, that is the selectioncountrule

http://nishantrana.me/2011/08/24/enabling-button-in-subgrid-on-selection-of-record-selectioncountrule-in-crm-2011/

https://msdn.microsoft.com/en-us/library/gg309316.aspx

image

Then here is the result

image

If I select 1 or 2

image

And if I select more than 2

image

And here is when you click and you get selected IDs

image

Hope this helps.

Thanks.

4 comments:

  1. FetchXML you can here online http://msxrmtools.com

    ReplyDelete
  2. Best Content Writing Courses in Bangalore with 100% Placement Assiatance. Work On Live Projects & Premium Tools. Content writing certification course.
    https://onlineidealab.com/content-writing-courses-in-bangalore/

    ReplyDelete

My Name is..