Custom Action Name
Batch_Navigate_Selected_ToCloseCase_From_Cases
Objects affected
None. This is purely a navigation action.
Description
This is an example of a combination drill up / drill down the action. It moves a user from sibling to sibling.
Use Cases
Navigate from a case to all the sibling cases based on the account.
Steps
crmc.require(['sfdc', 'KendoPopup'], function (sfdc, popup) { crmc.addCustomAction({ "itemID": "Batch_Navigate_Selected_ToCloseCase_From_Cases", "isAvailable": function (context) { // This function is called before the action item is displayed and returns a boolean if the item should be displayed // By default determine availability based on Feature Security for this action var hasSecurity = this.featureSecurity.getSetting(context.objectDescribe.name, this.itemID) !== false var isCase = context.objectDescribe.name == ("Case"); return hasSecurity && isCase }, "getLabel": function (context) { // This function returns the display label of the action item and is called before the item is shown return "Close Selected"; }, "createSubmenuItems": function (context) { // If this function returns additional action item objects, they will appear as submenu items return []; }, "click": function (context) { if (context.selectedRows.length > 0) { var selectedIds = []; var queryParams = {object: 'Case', viewId: 'a06o000000HQ4PeAAL'}; Object.each(context.selectedRows, function (item) { var id = item["Id"]; if(id === undefined || id === null){ //Do nothing if empty. } else { selectedIds.push(id); } }); if (selectedIds.length > 200) { var postData = {Ids: selectedIds.join()}; //sfdc.postToVFPage("c", "AG_Case_Nav_Selected", queryParams, postData, false, '_BLANK'); sfdc.postToVFPage("CRMC_PP", "crmc_grid", queryParams, postData, false, '_BLANK'); }else { queryParams.Ids = selectedIds.join(); //sfdc.navigateToVFPage("c", "AG_Case_Nav_Selected", queryParams, false, '_BLANK'); sfdc.navigateToVFPage("CRMC_PP", "crmc_grid", queryParams, false, '_BLANK'); } } else { popup.popup('Please select records', 'Select at least one record for navigating selected records'); } } });});