locked
Javascript on Ribbon button RRS feed

  • Question

  • Hi,

    Basically, I just want to have a windows.close function after clicking "Reply" on email form.

    I found it should be able to do something on customizations.xml. According to the code below, I'm not able to find out the original action of the command "Mscrm.Form.email.Reply". And I'm not sure my code is correct or not, or is there any other possibilities to achieve this? I just want to close the current Windows after I clicked "Reply".

    <CommandDefinitions>
              <CommandDefinition Id="Mscrm.Form.email.Reply">
                <EnableRules>
                       <EnableRule Id="new.email.form.ReplyCloseWindows.EnableRule" />
                </EnableRules>
                <DisplayRules />
                <Actions><JavaScriptFunction FunctionName="???????" Library="?????????" /></Actions>
              </CommandDefinition>
            </CommandDefinitions>
            <RuleDefinitions>
              <TabDisplayRules />
              <DisplayRules></DisplayRules>
              <EnableRules>
                <EnableRule Id="new.email.form.ReplyCloseWindows.EnableRule">
                  <CustomRule FunctionName="closewindows" Library="$webresource:new_emailreply.js"></CustomRule>
                </EnableRule>
              </EnableRules>
            </RuleDefinitions>

    Regards,
    Rayson

    Monday, August 8, 2011 4:20 AM

Answers

  • Try this:

    <CommandDefinitions>
              <CommandDefinition Id="RibbonSolution.email.form.ReplyCloseWindows.Command">
                <EnableRules>
                       <EnableRule Id="RibbonSolution.email.form.ReplyCloseWindows.EnableRule" />
                </EnableRules>
                <DisplayRules />
                <Actions>FunctionName="closewindows" Library="$webresource:new_emailreply.js"></Actions>
              </CommandDefinition>
            </CommandDefinitions>
            <RuleDefinitions>
              <TabDisplayRules />
              <DisplayRules></DisplayRules>
              <EnableRules>
                <EnableRule Id="RibbonSolution.email.form.ReplyCloseWindows.EnableRule">
                  <CustomRule Default="false" FunctionName="closewindows" Library="$webresource:new_emailreply.js">
                </EnableRule>
              </EnableRules>
            </RuleDefinitions>

    You may also want to look into the SDK to set your Display Rules, too. But I think this will be enough to get it working.


    --Dodd
    Thursday, August 11, 2011 10:17 PM