Thursday, February 23, 2012

MS CRM 2011: Bulk refresh of user details from AD

When you create user in CRM all the available information is populated from AD into CRM user form. But in case information was changed in AD (email box, phone e.t.c.) - information will remain unchanged till the moment you will open form of user and change it. In case a lot of information was changed it will be quite boring to update users information one-by-one.

Following post describes how to allow bulk update of user details.

Saturday, February 11, 2012

Wednesday, February 08, 2012

CRM 2011: Playing with notes control

If you want for some reason to allow/disallow user to insert or edit notes in Microsoft Dynamics CRM 2011 following code can help you:

function FormatNotesControl(AllowInsert, AllowEdit)
{
var notescontrol = document.getElementById('notescontrol');
if (notescontrol == null)
return;
var url = notescontrol.src;

if (!AllowInsert)
url = url.replace("EnableInsert=true", "EnableInsert=false");
if (!AllowEdit)
url = url.replace("EnableInlineEdit=true", "EnableInlineEdit=false");

notescontrol.src = url;
}

function DisableNotesInsert()
{
FormatNotesControl(false, true);
}


Copy script, insert it to webresource, add this webresource to required form and call it during onload/onchange of form. And you should not forget that this script is unsupported because it uses document object and it's methods.

CRM 2011: Creating a Network Path Text Control for Microsoft Dynamics CRM 2011

Following approach is a little bit unsupported so be careful using it.

Create JavaScript webresource, put in it following code, call OnLoad method during loading of form of your entity:

function OnLoad()
{
Transform("new_name");
}

function Transform(fieldid)
{
var c = document.getElementById(fieldid);
if (c == null)
return;

c.style.textDecoration = "underline";
c.style.color = "blue";
c.style.cursor = "hand";
c.ondblclick = function()
{
window.open(Xrm.Page.getAttribute(fieldid).getValue());
};
}


Field has to be simple text type. Replace new_name with field you want to transform. Result for my case: