Wednesday, April 11, 2012

Adding Navigation Link in crm 2011 form - An update if doing in xml

In crm 4.0, the only way to add a navigation link was to edit the xml to add a <NavBarItem> node. In CRM 2011, in addition to messing with the xml, the form ui can be used to modify the navigation pane. But if you want to enable the PassParams option, you will still need to export the solution, manually edit the customizations.xml file, zip it up and reimport.

When I first started adding navigation links in xml, the following snippet for <NavBarItem> which I used in CRM 4.0, would work in crm 2011 too. It goes under Entity / FormXml/ Navigation/ NavBar.

<NavBarItem Id="test" Area="Info" Icon="$webresource:new_Enterprise_Contacts_icon" Url="<url>" PassParams="1" Sequence="9600">
<Titles>
<Title LCID="1033" Text="Test Link" />
</Titles>
</NavBarItem>





















When I tried that last week, the same <NavBarItem> did not display the new navigation link. To see what was different, I manually added a link using the Form UI, exported the solution, unzipped it and opened the customizations.xml file. If you notice the xml piece below, there is a new attribute called solutionaction, with the value of Added.


<NavBarItem Id="test" Area="Info" Icon="$webresource:new_Enterprise_Contacts_icon" Url="<url>" Sequence="9600" solutionaction="Added">
<Titles>
<Title LCID="1033" Text="Test Link" />
</Titles>
</NavBarItem>

That being the only difference, I updated my xml snippet to add the solutionaction attribute, and created a new <NavBarItem> element. Notice too that I have the PassParams set to yes.


<NavBarItem Id="test" Area="Info" Icon="$webresource:new_Enterprise_Contacts_icon" Url="<url>" PassParams="1" Sequence="9600" solutionaction="Added">
<Titles>
<Title LCID="1033" Text="My Test Link" />
</Titles>
</NavBarItem>


With the above in my customizations file, the imported solution has the 2 navigation links, "test Link" that was created using the UI, and "My Test Link" created by editing the customizations.xml file.
























The interesting thing is that the definition for the navigation item that displays in a form does not specify the solutionaction attribute. But when it is not part of the xml, the nav link does not display at all!
http://msdn.microsoft.com/en-us/library/gg328202.aspx


Here is the link for the reference to edit the Form XML in Microsoft Dynamics CRM, in case anyone is interested:
http://msdn.microsoft.com/en-us/library/gg327975.aspx

1 comment:

  1. navigation successful and its working properly but the problem is when every we want to re structure we should follow these steps again

    CRM customer relationship management
    Lead Management Software

    ReplyDelete