Skip to main content
Conga Support

Hypernavigate Selected Cases from Cases

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 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

The use of JavaScript in Conga solutions is considered an advanced method, requiring JavaScript knowledge, and is not supported by Conga or the Conga support team. You are welcome to use this feature at your own risk.

Follow these steps to create the custom action:

  1. Click ActionGrid Setup.
  2. Select the object for which you want to create the custom action.
  3. Select the object Features tab.
  4. Click New Custom Action. The Custom Action screen appears.
  5. Delete the sample code from the Javascript field.
  6. Copy and paste the following code into the Javascript field.
  7. Copy the itemID value and paste it as the Action Name.
  8. Click OK.
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');
              }
        }
    });
});