Jeffrey from CWR Mobility had a great post, "Adding Next/Previous" buttons to Entity Details Form Revisited ", that demonstrated how you can add Previous & Next buttons to quickly navigate within a CRM Grid. Not only did his post address the out of box entities in CRM, his solution worked for custom entities as well. This solution worked great in Dynamics CRM 3.0 but 4.0 introduced a few schema changes to the ISV.Config file that required a few updates to the sample he provided in his post. You can download the update version of the ISV.Config file compatible with CRM 4.0 at the bottom of this blog post.
How To Enable This Functionality For Out-of-Box Entities:
Add the XML below to your ISV.Config file to enable the Next/Previous buttons for the Account entity.
<Entity name="account">
<ToolBar ValidForCreate="0" ValidForUpdate="1">
<Button JavaScript="if(window.opener.document.all['crmGrid'] != null) { var _cwrRecordIndex; var _cwrGrid=window.opener.document.all['crmGrid'].InnerGrid; var _cwrRecords=_cwrGrid.AllRecords; for(var i=0; i<_cwrRecords.length; i++){if(_cwrRecords[i ][0] == crmForm.ObjectId){if(i!=0){window.location.href=window.location.href.split('?')[0]+'?id='+_cwrRecords[i-1][0];_cwrGrid.UnselectRecords();_cwrGrid.SelectRecords(i-1,i-1,false);}}}}else{alert('This button only works when the record is opened from a grid.');}" Client="Web" Icon="/_imgs/navUp.gif">
<Titles><Title LCID="1033" Text="Previous"/></Titles><ToolTips><ToolTip LCID="1033" Text="Previous"/></ToolTips>
</Button>
<Button JavaScript="if(window.opener.document.all['crmGrid'] != null) { var _cwrRecordIndex; var _cwrGrid=window.opener.document.all['crmGrid'].InnerGrid; var _cwrRecords=_cwrGrid.AllRecords; for(var i=0; i<_cwrRecords.length; i++){if(_cwrRecords[i ][0] == crmForm.ObjectId){if(i!=_cwrRecords.length-1){window.location.href=window.location.href.split('?')[0]+'?id='+_cwrRecords[i+1][0];_cwrGrid.UnselectRecords();_cwrGrid.SelectRecords(i+1,i+1,false);}}}}else{alert('This button only works when the record is opened from a grid.');}" Client="Web" Icon="/_imgs/navDown.gif">
<Titles><Title LCID="1033" Text="Next"/></Titles><ToolTips><ToolTip LCID="1033" Text="Next"/></ToolTips>
</Button>
</ToolBar>
</Entity>
To enable this customization for other out of box entities, change the name of the entity in the fist line from account to whatever entity you like (Ex. <Entity name="contact">).
How To Enable This Functionality for Custom Entities:
In order to get this to work for custom entities, the JavaScript had to be slightly modified. The reason for the change is that the Url of a custom entity is shared by all custom entities. The Url not only contains the 32-digit GUID of the custom entity, it also contains a parameter called etn (Entity Type Name). To properly reference the Url of a custom entity you have to include the GUID and the name of the entity in the Url. Since the XML is almost identical to that for out-of-box entities I won't post the XML here (the XML is included in the ISV.Config download in this post), rather I'll post the line of JavaScript that needs to be updated in order to deploy the buttons for custom entities.
In the XML you will see the following code:
window.location.href=window.location.href.split('?')[0]+'?id='+_cwrRecords[i+1][0]+'&etn=new_customentity';
When you insert the XML for a custom entity, change the bolded item above to the name of your actual custom entity. For each custom entity where you deploy this code you will have to update it 2 times, once in the JavaScript for the Previous button and once for the Next button.
See It In Action:
Image 1: The screen shot below is just before the Next button is clicked inside the CRM Account Form.

Image 2: The next account in the grid is now loaded in the Account detail form and the grid is updated to reflect the new account displayed as well.

Image 3: This is just before the Previous button is clicked to go back to the prior record

Image 4: Now the previous record in the grid has been loaded in the Account detail form and the grid once again has been updated as well

This is definitely a handy little customization that will eliminate a few clicks for your end users. Again, a big thanks to Jeffrey from CWR Mobility for building this customization.
Download ISV.Config file
- Jeremy