Dynamics CRM, Mobility and other stuff

vrijdag, juli 10, 2009

Adding "Next/Previous" buttons to Entity Details Form Revisited...Again

Ok, I've been rather busy the last, eh, year. But today I got another comment on one of my most popular posts, Adding "Next/Previous" buttons to Entity Details Form Revisited.

Jeremy Winchell explained how he made this customization work for Dynamics CRM 4.0. So I thought I'd update the download to support CRM 4.0.

To make this work you have to export the ISV Config Customization from CRM. Then copy the <Entity>...</Entity> contents from the isv.config.xml file and put it between the <configuration><Entities> elements in the exported ISV Config file. Then upload the file again and voila, you have your next/previous buttons in CRM 4.0!

Thanks Jeremy!

Download the CRM 4.0 version here.

Download the CRM 3.0 version here.

Labels: ,

vrijdag, december 14, 2007

Adding "Next/Previous" buttons to Entity Details Form Revisited

It's funny to get a lot of reactions lately on a post (from almost two years ago!), Adding "Next/Previous" buttons to Entity Details Form. Maybe it has to do with this post from Philip Richardson, I don't know :).

Anyway, thanks to some feedback from Matt Wittemann and Jim Steger I've made some small updates. One is an addition to support custom entities (thanks Matt) and one is a bugfix, it gave an error when using the buttons on a form that is not opened from a grid (thanks Jim).

I've updated the sample code in the zip file with these additions.

Another comment from Bart Vierbergen about an enhanced for CRM 4.0 (using the entitytypename instead of entitytypecode) I leave as a simple exercise for the reader :).

Download the new version here.

Labels: ,

dinsdag, december 27, 2005

Adding "Next/Previous" buttons to Entity Details Form

Update: I've updated the sample due to some feedback I received, read about it here! BTW, the download link at the bottom of this article also points to the updated sample!

Last week, I was looking through the history of a Contact in CRM, trying to locate a certain e-mail activity. So I opened the History tab and opened the first e-mail. Nope, not the one. Next.

After closing and opening 4 e-mails, I thought it would be nice to have some Previous/Next buttons, just like Outlook has when you open an e-mail. It's not very productive to keep opening and closing those popup windows.

So I came up with some javascript that does this for me. All you have to do is put this in your isv.config.xml:

< name="account">< validforcreate="0" validforupdate="1">< title="Previous" javascript="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);}}}" client="Web" icon="/_imgs/cwr_previous.gif">< title="Next" javascript="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);}}}" client="Web" icon="/_imgs/cwr_next.gif">

Note, it should go all on one line in your isv.config.xml. No line breaks.

Note 2: I put a space between the "<" and the element name, otherwise blogger thinks it's markup. I didn't really optimize the javascript code. Probably could be better, but this is the quick and dirty approach and I didn't feel like including a javascript file and then calling a function. All the code is inside the Javascript attribute. Also note that I use some undocumented javascript methods, so it's not supported! BTW, If you paid attention you would see that the code uses the entity "account". That's right. Unfortunately, CRM only permits you to customize the detail forms of certain entities, namely: account campaign campaignactivity campaignresponse incident (SDK wrongly calls this case) contact Custom entities invoice lead list opportunity salesorder quote You see? No activities! Anyway, for educational purposes I continue :). It does work for the other entities. So if you want to quickly browse through the invoices of an account, you can do that. Just add the two buttons to the invoice entity in your isv.config.xml. Here's a screenshot that shows browsing through accounts. Screenshot.

You can download a zip file which includes a sample isv.config.xml file and two images that you can put in the _imgs folder of your CRM webroot. Download it here.

Have fun!

Labels: ,