Neil McDonald's Dynamics 365 Blog

Archive for Jul 2010

View originating lead notes on a contact

leave a comment »

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";
}

Written by neilmcd

Jul 9, 2010 at 10:38 am

Posted in CRM 4

Tagged with , , ,

Hide tabs and disable fields based on user roles

leave a comment »

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.

Read the rest of this entry »

Written by neilmcd

Jul 8, 2010 at 6:58 pm

Posted in CRM 4

Tagged with , ,

Changing an Active Directory username in CRM

leave a comment »

Add_user_error

One of our users had complained that their name was spelled incorrectly. I made the changes in AD, Exchange and in her CRM user account, but when I tried to change her domain login name in CRM, I received the error ‘You are attempting to create a user with a domain logon that is already used by another user…’

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

Written by neilmcd

Jul 7, 2010 at 6:06 pm

Posted in CRM 4

Tagged with ,

Google Maps in CRM

leave a comment »

Tumblr_l56ytphlmo1qccrkio1_1280

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!

Written by neilmcd

Jul 5, 2010 at 10:27 pm

Posted in CRM 4

Tagged with ,