Monday, May 9, 2011

Hiding Ribbon Button in CRM 2011

Hi All, Here i am going to hide a ribbon button from account entity at form level and home page grid level.

Before Hiding Button from the Account Home page Grid
After Hiding the Button from the Account Home page Grid
Before Hiding button from the Account Form
After Hiding button from the Account Form

Follow the following steps to hide the button from the account entity

1. We needs to find the Id of the button " Add to Marketing List", which we wants to hide. To find the Id of this button go to the CRM Sdk, and find the "accountribbon.xml" file at "sdk\samplecode\cs\client\ribbon\exportribbonxml\exportedribbonxml". Open "accountribbon.xml" file and find the Id of the button which we wants to hide. 
  For "Add to Marketing List" button Id at Home page grid level is "Mscrm.HomepageGrid.account.AddToList"
 For "Add to Marketing List" button Id at Form level is "Mscrm.Form.account.AddToList"
2. Now Export the solution and open the "Customization.xml" file for editing.
3. Find the <RibbonDiffXml> tag at Account entity level, add the following code

Here is the code to copy
<RibbonDiffXml>
 <CustomActions>
 <!-- Hide "Add to Marketing List" button at grid level, here Location will be the button id and HideActionId will be any unique id-->
 <HideCustomAction Location="Mscrm.HomepageGrid.account.AddToList" HideActionId="Sample.HomepageGrid.account.HideMarketingList"/>
 <!-- Hide "Add to Marketing List" button at Form level-->
 <HideCustomAction Location="Mscrm.Form.account.AddToList" HideActionId="Sample.Form.account.HideMarketingList"/>
 </CustomActions>
        <Templates>
          <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
        </Templates>
        <CommandDefinitions />
        <RuleDefinitions>
          <TabDisplayRules />
          <DisplayRules />
          <EnableRules />
        </RuleDefinitions>
        <LocLabels />
      </RibbonDiffXml>

4. Now import the solution back into CRM. You can find the changes.

Thats it.. It's very simple to hide a button in crm2011. we can also use Display rules to hide the buttons. Based on the user security permission we can show the buttons using display rules.




Thursday, May 5, 2011

Sitemap Customization in CRM 2011

Sitemap customization in crm 2011 will be similar to crm 4.0. Now I am just trying add new Area Section to the Existing CRM. Lets see how to add new area,groups and subgroups in crm.



Follow the following steps

1. Add sitemap resource to the solution. In the solution click on "Client Extensions" and then click on "Add Existing" and add "SiteMap".

2. Now Export the solution and then extract the zip file, you will find "Customizations.xml" file. open it in the visual studio for editing.

3. Find the <SiteMap> tag, start editing the sitemap. To get intelligence for sitemap editing, attach the following schema file to visual studio.
   you can find this file in the CRM SDK "sdk\schemas\customizationssolution.xsd". To add this file into visual studio, click on "XML" menu ==> "Schemas" ==> browse the customizationssolution.xsd file and then add. Now you will get intelligence in visual studio.

4. Now edit the sitemap

   Here is the code to add new Area
<!-- Adding New Area to CRM. Give some unique values to Id, ResourceId properties -->
<Area Id="customer_Area" ResourceId="Area_MyArea" ShowGroups="true" Icon="/_imgs/resourcecenter_24x24.gif"  Title="Customer Area">
<!-- Adding new group, Title is mandatory and which will be the display text of area/group -->
<Group Id="MYGroup"  Title="My Group">
<!-- Adding links to the group, Add the required entity links to this group-->
<SubArea Id="nav_contacts" Entity="contact" DescriptionResourceId="Contact_SubArea_Description" GetStartedPanePath="Contacts_Web_User_Visor.html" GetStartedPanePathAdmin="Contacts_Web_Admin_Visor.html" GetStartedPanePathOutlook="Contacts_Outlook_User_Visor.html" GetStartedPanePathAdminOutlook="Contacts_Outlook_Admin_Visor.html" />
<SubArea Id="nav_accts" Entity="account" DescriptionResourceId="Account_SubArea_Description" GetStartedPanePath="Accounts_Web_User_Visor.html" GetStartedPanePathAdmin="Accounts_Web_Admin_Visor.html" GetStartedPanePathOutlook="Accounts_Outlook_User_Visor.html" GetStartedPanePathAdminOutlook="Accounts_Outlook_Admin_Visor.html" >
<!-- If the user contains write privilages on account then only this link will appear-->
<Privilege Entity="account" Privilege="Write"/>
</SubArea>
</Group>
</Area>

 5. After finishing the editing, import back the solution to CRM. changes will be reflected. Thats it... simplified way to edit sitemap...