locked
Calling OOB Ribbon Actions from custom Javascript RRS feed

  • Question

  • I have seen many posts regarding this issue.

    1. That this is not supported

    2. That some have gotten it to work

    I have tried this with no success. The system function I was trying to call, takes a CRM Parameter (Primary Control).

    I guess the question is what is the alternative, if this functionality is not supported?

    The useful scenario is to add a 'JS Confirm' functionality before the system action is executed.

    Here is the Command Definition:

    <CommandDefinition Id="Override.Account.SavePrimary">
          <EnableRules>
            <EnableRule Id="Mscrm.AvailableOnForm" />
            <EnableRule Id="Mscrm.CanSavePrimary" />
            <EnableRule Id="Mscrm.ReadPrimaryPermission" />
            <EnableRule Id="Mscrm.IsAutoSaveDisable" />
          </EnableRules>
          <DisplayRules>
            <DisplayRule Id="Mscrm.CanSavePrimaryEntityType" />
          </DisplayRules>
          <Actions>
            <JavaScriptFunction FunctionName="testsave" Library="$webresource:newab_testscirpt">
              <CrmParameter Value="PrimaryControl" />
            </JavaScriptFunction>
          </Actions>
        </CommandDefinition>

    And the JS:

    function testsave(PrimayControl) {
        if (confirm("Are you sure?"))
            Mscrm.RibbonActions.saveForm(PrimayControl);
     }

    • Edited by Anwar B Thursday, May 25, 2017 4:07 PM
    Thursday, May 25, 2017 3:40 PM