Archive for Jul 2010
View originating lead notes on a contact
Our sales guys wanted a way to view originating lead notes against the Contacts created from Leads. I added a new tab to the contact containing an Iframe and used the below javascript to display the notes from the originating lead.
var lookupItem = new Array; //set the lookup to the originating lead lookupItem = crmForm.originatingleadid.DataValue; if (lookupItem != null) { //display the originating lead notes in the iframe 'IFRAME_LeadNotes' crmForm.all.IFRAME_LeadNotes.src="/_controls/notes/notesdata.aspx?id="+ lookupItem[0].id + "&ParentEntity=3&EnableInlineEdit=false&EnableInsert=false"; } else { //if there is no originating lead, hide the tab crmForm.all.IFRAME_LeadNotes.src="about:blank"; tab7Tab.style.display = "none"; }
Hide tabs and disable fields based on user roles
The below is a way to hide a tab to everyone not in the Account Manager and System Administrator roles. There’s also a slightly less polished method to disable fields to everyone not in the System Administrator role.
You should be able to copy and paste the below script into your OnLoad event and change the bottom 2 lines of code to specify the tab you want to hide. It wil then hide it from everyone not in the roles specified. You’ll also have to change the attribute names which you want to disable in the HideField function.
Changing an Active Directory username in CRM
To get around it, I made the change directly in the organisation database. The domain login name is stored in the ‘DomainName’ column of the ‘SystemUserBase’ table, so I just edited the data within SQL management studio.
FYI – Although I do this, I don’t recommend making any changes to the CRM databases directly. A safer workaround is posted here
Google Maps in CRM
I wanted a quick way of viewing an Account’s location so I created a link to Google maps based on the postcode of the Account.
First of all, create an nvarchar/URL attribute called new_googlemaps, stick it somewhere on your Account form and then put the below javascript into the Account OnLoad event
crmForm.all.new_googlemaps.DataValue = “http://maps.google.com/maps?q=”+crmForm.all.address1_postalcode.DataValue;
It’s pretty basic but does exactly what I want. I’m going to look at embedding the actual map in an iframe when I get the chance
Edit: it turns out that Richard Knudson has covered embedding maps already on his site!