locked
Adding custom JavaScript to an Out Of Box Ribbon Button RRS feed

  • Question

  • Hi Guys,

    I am trying to add a JavaScript function to the out of the box ribbon button 'Add Existing". Below is what i currently have, this does not seem to be getting the job done. Any ideas as to what I may be doing wrong? 

    <RibbonDiffXml>
    	<CustomActions>
    	  <HideCustomAction Location="Mscrm.Form.EntityName.SaveAndNew" HideActionId="Mscrm.Form.EntityName.SaveAndNew.HideAction" />
    	  <HideCustomAction Location="Mscrm.SubGrid.EntityName.AddNewStandard" HideActionId="Mscrm.SubGrid.EntityName.AddNewStandard.HideAction" />
    	  <HideCustomAction Location="Mscrm.SubGrid.EntityName.Edit" HideActionId="Mscrm.SubGrid.EntityName.Edit.HideAction" />
    	  <HideCustomAction Location="Mscrm.SubGrid.EntityName.NewRecord" HideActionId="Mscrm.SubGrid.EntityName.NewRecord.HideAction" />
    	  
    	  <CustomAction Id="Mscrm.SubGrid.EntityName.AddExistingAssoc_CustomAction" Location="Mscrm.SubGrid.EntityName.AddExistingAssoc" Sequence="40"> 
    		<CommandUIDefinition>
    			<Button Id="Mscrm.SubGrid.EntityName.AddExistingAssoc"  
    			Command="Mscrm.AddExistingRecordFromSubGridAssociated_CustomAction"  
    			Sequence="40" LabelText="$Resources(EntityDisplayName):Ribbon.SubGrid.AddExisting" 
    			Alt="$Resources(EntityDisplayName):Ribbon.SubGrid.AddExisting" 
    			Image16by16="/_imgs/ribbon/AddExistingStandard_16.png" 
    			Image32by32="/_imgs/ribbon/AddExistingStandard_32.png" 
    			TemplateAlias="o1" 
    			ToolTipTitle="$Resources(EntityDisplayName):Mscrm_SubGrid_EntityLogicalName_MainTab_Management_AddExistingAssoc_ToolTipTitle" 
    			ToolTipDescription="$Resources(EntityDisplayName):Mscrm_SubGrid_EntityLogicalName_MainTab_Management_AddExistingAssoc_ToolTipDescription"/>
    		</CommandUIDefinition>
    	  </CustomAction>
    	</CustomActions>
    	<Templates>
    	  <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
    	</Templates>
    	<CommandDefinitions>
    		<CommandDefinition Id="Mscrm.AddExistingRecordFromSubGridAssociated_CustomAction">
    		  <EnableRules>
    			<EnableRule Id="Mscrm.AddExistingRecordFromSubGridAssociated_CustomRule" />
    			<EnableRule Id="Mscrm.AppendToPrimary" />
    			<EnableRule Id="Mscrm.EntityFormIsEnabled" />				
    		  </EnableRules>
    		  <DisplayRules>
    			<DisplayRule Id="Mscrm.AddExisting" />
    			<DisplayRule Id="Mscrm.ShowForManyToManyGrids" />
    			<DisplayRule Id="Mscrm.AppendToPrimary" />
    			<DisplayRule Id="Mscrm.AppendSelected" />
    		  </DisplayRules>
    		  <Actions />			  
    		</CommandDefinition>
    	</CommandDefinitions>
    	<RuleDefinitions>
    	  <TabDisplayRules />
    	  <DisplayRules />
    	  <EnableRules>
    		<EnableRule Id="Mscrm.AddExistingRecordFromSubGridAssociated_CustomRule">
    			<CustomRule FunctionName="myFunction" Library="$webresource:MyFile" Default="false" />
    		</EnableRule>
    	</EnableRules>
    	</RuleDefinitions>
    	<LocLabels />
      </RibbonDiffXml>

    Thanks

    Wednesday, June 4, 2014 12:14 PM

Answers

All replies