web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

XML Button

(0) ShareShare
ReportReport
Posted on by 745

I am trying to create a button using XML that is part of the account ribbon grid and form.  I have already created the button but I am trying to insert Java into it.  I need to be able to insert multiple Java commands into it.  I seem to only be able to do two.  I have created the web resources and the Java is in Dynamics.  Does anyone have any suggestions on building a custom button and how to insert Java.  Here is the code below.  I am using a code that came from and SDK template.  Am I going about this the wrong way?  Thanks

<ImportExportXml xmlns:xsi="www.w3.org/.../XMLSchema-instance">

 <Entities>

   <Entity>

     <Name LocalizedName="Account" OriginalName="Account">Account</Name>

     <ObjectTypeCode>1</ObjectTypeCode>

     <RibbonDiffXml>

       <CustomActions>

         <CustomAction Id="Sample.account.grid.SendToOtherSystem.CustomAction" Location="Mscrm.HomepageGrid.account.MainTab.Collaborate.Controls._children" Sequence="41">

           <CommandUIDefinition>

             <Button Id="Sample.account.grid.SendToOtherSystem.Button" Command="Sample.account.grid.SendToOtherSystem.Command" LabelText="$LocLabels:Sample.account.SendToOtherSystem.LabelText" ToolTipTitle="$LocLabels:Sample.account.SendToOtherSystem.LabelText" ToolTipDescription="$LocLabels:Sample.account.SendToOtherSystem.ToolTip" TemplateAlias="o1" Image16by16="$webresource:sample_/icons/TIcon16x16.png" Image32by32="$webresource:new_RadioButton" />

           </CommandUIDefinition>

         </CustomAction>

         <CustomAction Id="Sample.account.form.SendToOtherSystem.CustomAction" Location="Mscrm.Form.account.MainTab.Collaborate.Controls._children" Sequence="33">

           <CommandUIDefinition>

             <Button Id="Sample.account.form.SendToOtherSystem.Button" Command="Sample.account.form.SendToOtherSystem.Command" LabelText="$LocLabels:Sample.account.SendToOtherSystem.LabelText" ToolTipTitle="$LocLabels:Sample.account.SendToOtherSystem.LabelText" ToolTipDescription="$LocLabels:Sample.account.SendToOtherSystem.ToolTip" TemplateAlias="o1" Image16by16="$webresource:sample_/icons/TIcon16x16.png" Image32by32="$webresource:new_RadioButton" />

           </CommandUIDefinition>

         </CustomAction>

       </CustomActions>

       <Templates>

         <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>

       </Templates>

       <CommandDefinitions>

         <CommandDefinition Id="Sample.account.grid.SendToOtherSystem.Command">

           <EnableRules>

             <EnableRule Id="Sample.account.WebClient.EnableRule" />

             <EnableRule Id="Sample.account.grid.OneSelected.EnableRule" />

           </EnableRules>

           <DisplayRules>

             <DisplayRule Id="Sample.account.WebClient.DisplayRule" />

           </DisplayRules>

           <Actions>

             <JavaScriptFunction Library="$webresource:new_proj4jscompressed" FunctionName="send" />

           </Actions>

         </CommandDefinition>

         <CommandDefinition Id="Sample.account.form.SendToOtherSystem.Command">

  <EnableRules>

             <EnableRule Id="Sample.account.WebClient.EnableRule" />

             <EnableRule Id="Sample.account.form.NotNew.EnableRule" />

           </EnableRules>

           <DisplayRules>

             <DisplayRule Id="Sample.account.form.FormStateNotNew.DisplayRule" />

             <DisplayRule Id="Sample.account.WebClient.DisplayRule" />

           </DisplayRules>

           <Actions>

             <JavaScriptFunction Library="$webresource:new_Proj4js" FunctionName="btnToUTM_OnClick" />

           </Actions>

         </CommandDefinition>

 </CommandDefinitions>

       <RuleDefinitions>

         <TabDisplayRules />

         <DisplayRules>

           <DisplayRule Id="Sample.account.form.FormStateNotNew.DisplayRule">

             <FormStateRule State="Create" InvertResult="true" />

           </DisplayRule>

           <DisplayRule Id="Sample.account.WebClient.DisplayRule">

             <CrmClientTypeRule Type="Web" />

           </DisplayRule>

         </DisplayRules>

         <EnableRules>

           <EnableRule Id="Sample.account.WebClient.EnableRule">

             <CrmClientTypeRule Type="Web" />

           </EnableRule>

           <EnableRule Id="Sample.account.form.NotNew.EnableRule">

             <FormStateRule State="Create" InvertResult="true" />

           </EnableRule>

           <EnableRule Id="Sample.account.grid.OneSelected.EnableRule">

             <SelectionCountRule AppliesTo="SelectedEntity" Maximum="1" Minimum="1" />

           </EnableRule>

         </EnableRules>

       </RuleDefinitions>

       <LocLabels>

         <LocLabel Id="Sample.account.SendToOtherSystem.LabelText">

           <Titles>

             <Title languagecode="1033" description="Check Serviceability" />

           </Titles>

         </LocLabel>

         <LocLabel Id="Sample.account.SendToOtherSystem.ToolTip">

           <Titles>

             <Title languagecode="1033" description="Sends GPS Data to SpatialWeb" />

           </Titles>

         </LocLabel>

       </LocLabels>

     </RibbonDiffXml>

   </Entity>

 </Entities>

 <Roles></Roles>

 <Workflows></Workflows>

 <FieldSecurityProfiles></FieldSecurityProfiles>

 <Templates />

 <RibbonDiffXml>

   <CustomActions />

   <Templates>

     <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>

   </Templates>

   <CommandDefinitions />

   <RuleDefinitions>

     <TabDisplayRules />

     <DisplayRules />

     <EnableRules />

   </RuleDefinitions>

   <LocLabels />

 </RibbonDiffXml>

 <EntityMaps />

 <EntityRelationships />

 <OrganizationSettings />

 <optionsets />

 <WebResources>

   <WebResource>

     <WebResourceId>{afe14434-85ad-df11-bcbe-00155d016807}</WebResourceId>

     <Name>sample_/icons/TIcon16x16.png</Name>

     <DisplayName>sample_/icons/TIcon16x16.png</DisplayName>

     <Description>A 16x16 pixel icon showing the letter 'T'.</Description>

     <WebResourceType>5</WebResourceType>

     <IsCustomizable>1</IsCustomizable>

     <CanBeDeleted>1</CanBeDeleted>

     <IsHidden>0</IsHidden>

     <FileName>/WebResources/sample_iconsTIcon16x16pngAFE14434-85AD-DF11-BCBE-00155D016807</FileName>

   </WebResource>

   <WebResource>

     <WebResourceId>{49cb1950-85ad-df11-bcbe-00155d016807}</WebResourceId>

     <Name>sample_/icons/TIcon32x32.png</Name>

     <DisplayName>sample_/icons/TIcon32x32.png</DisplayName>

     <Description>A 32x32 pixel icon showing the letter 'T'.</Description>

     <WebResourceType>5</WebResourceType>

     <IsCustomizable>1</IsCustomizable>

     <CanBeDeleted>1</CanBeDeleted>

     <IsHidden>0</IsHidden>

     <FileName>/WebResources/sample_iconsTIcon32x32png49CB1950-85AD-DF11-BCBE-00155D016807</FileName>

   </WebResource>

   <WebResource>

     <WebResourceId>{566418ff-73b7-df11-840e-00155dba380f}</WebResourceId>

     <Name>sample_SendToOtherSystem.js</Name>

     <DisplayName>SendToOtherSystem.js</DisplayName>

     <WebResourceType>3</WebResourceType>

     <IsCustomizable>1</IsCustomizable>

     <CanBeDeleted>1</CanBeDeleted>

     <IsHidden>0</IsHidden>

     <FileName>/WebResources/sample_SendToOtherSystemjs566418FF-73B7-DF11-840E-00155DBA380F</FileName>

   </WebResource>

 </WebResources>

 <Languages>

   <Language>1033</Language>

 </Languages>

</ImportExportXml>

*This post is locked for comments

I have the same question (0)
  • Verified answer
    jlattimer Profile Picture
    24,562 on at

    Instead of hand editing the XML you might use a tool like Ribbon Workbench which provides a GUI for wiring everything up.

    This article gives an idea on using JavaScript: Pass the currently selected grid row(s) to a Custom JavaScript Function

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans