Tag Archives: Microsoft Dynamics CRM 3.0

Improving GUI (static) information on forms

In MS CRM most of the data is stored in regular changeable text boxes. For data that needs to be changed often this is useful. For data that hardly changes the boxes take up a lot of valuable space on the form. When we thought of this we came to the conclusion that it would be nice to have the information shown on the form as regular text, with the ability to change it in the regular way. The information takes a lot less space of the form. The space that is left can be used to show other information.
We have come up with a solution as shown below. The solution is not finished yet. The lay-out can be improved, but more important some of the links are lost, because they are shown as plain text. I’m working on these improvements.

The first picture shows a filled account form. I have used the standard account form with 4 extra fields: 2 check boxes and 2 text fields. And some script. Technical description follows below the pictures.

To change the fields on the form, use the check boxes to make the sections shown. Change the regular fields and save the changes.

It is also possible to change only the contents of one of the two boxes.

This is just an example of the possibilities. Hope it helps improving the user experience of MS CRM.

For this example I have created 4 extra field on the account form:

2 text boxes: new_details and new_addressdetails.
2 check boxes:  new_changeaccountinformation and new_changeaddress.

For this example I just made it work, I haven’t build in al the business logic regarding changes in the regular boxes. In the script on the onLoad the text is written and overwritten. But to make clear what does what, I have placed the scripts on the onChange of the specific field it influences.

The Script

Account onLoad script to trigger the onChange scripts:

crmForm.all.new_addressdetails.FireOnChange();
crmForm.all.new_changeaddress.FireOnChange();
crmForm.all.new_details.FireOnChange();
crmForm.all.new_changeaccountinformation.FireOnChange();

new_details onChange script:

/*
copy values to variables
*/
if (crmForm.all.name.DataValue!=null)
{
var name = 'Account Name:\t' + crmForm.all.name.DataValue + '\n';
}
else
{
var name = "";
} 

if (crmForm.all.accountnumber.DataValue!=null)
{
var accountnumber = 'Account Number:\t' + crmForm.all.accountnumber.DataValue + '\n';
}
else
{
var accountnumber = "";
} 

if (crmForm.all.customertypecode.DataValue!=null)
{
var customertypecode = 'Relationship Type:\t' + crmForm.all.customertypecode.SelectedText + '\n';
}
else
{
var customertypecode = "";
} 

if (crmForm.all.telephone1.DataValue!=null)
{
var telephone1 = 'Main Phone:\t' + crmForm.all.telephone1.DataValue + '\n';
}
else
{
var telephone1 = "";
} 

if (crmForm.all.telephone2.DataValue!=null)
{
var telephone2 = 'Other Phone:\t' + crmForm.all.telephone2.DataValue + '\n';
}
else
{
var telephone2 = "";
} 

if (crmForm.all.fax.DataValue!=null)
{
var fax = 'Fax:\t\t' + crmForm.all.fax.DataValue + '\n';
}
else
{
var fax = "";
} 

if (crmForm.all.websiteurl.DataValue!=null)
{ 

var websiteurl = 'Website:\t\t' + crmForm.all.websiteurl.DataValue + '\n';
}
else
{
var websiteurl = "";
} 

if (crmForm.all.emailaddress1.DataValue!=null)
{
var emailaddress1 = 'E-mail:\t\t' + crmForm.all.emailaddress1.DataValue + '\n';
}
else
{
var emailaddress1 = "";
} 

if (crmForm.all.parentaccountid.DataValue!=null)
{
var lookup = crmForm.all.parentaccountid.DataValue;
if (lookup[0] != null)
{
var parentaccountid = 'Parent Account:\t' + lookup[0].name + '\n';
}
}
else
{
var parentaccountid = "";
} 

if (crmForm.all.primarycontactid.DataValue!=null)
{
var lookup = crmForm.all.primarycontactid.DataValue;
if (lookup[0] != null)
{
var primarycontactid = 'Primary Contact:\t' + lookup[0].name + '\n';
}
}
else
{
var primarycontactid = "";
} 

/*
create contents of text box
*/
crmForm.all.new_details.DataValue =
name.toString() +
accountnumber.toString() +
customertypecode.toString() + '\n' +
telephone1.toString() +
telephone2.toString() +
fax.toString() +
websiteurl.toString() +
emailaddress1.toString() +
parentaccountid.toString() +
primarycontactid.toString();
crmForm.all.new_details.ForceSubmit = true; 

/*
Change properties of the text box
*/
/*
make field readonly
*/
crmForm.all.new_details.readOnly = true;
/*
make background transparant
*/
crmForm.all.new_details.style.backgroundColor='transparent';
/*
hide scrollbar
*/
document.all.new_details.style.overflow='hidden';
/*
make font bold
*/
document.all.new_details.style.fontWeight='bold';
/*
change left padding
*/
document.all.new_details.style.paddingLeft='10px';
/*
make borders invisible
document.all.new_details.style.border='none';
*/

new_addressdetails onChange script:

/*
copy values to variables
*/
if (crmForm.all.name.DataValue!=null)
{
var name = crmForm.all.name.DataValue + '\n \n';
}
else
{
var name = "";
} 

if (crmForm.all.address1_name.DataValue!=null)
{
var addressname = crmForm.all.address1_name.DataValue + ' ';
}
else
{
var addressname = "";
} 

if (crmForm.all.address1_addresstypecode.DataValue!=null)
{
var addresstypecode = '('+crmForm.all.address1_addresstypecode.SelectedText +')'+ '\n';
}
else
{
var addresstypecode = "";
} 

if (crmForm.all.address1_line1.DataValue!=null)
{
var line1 = crmForm.all.address1_line1.DataValue + '\n';
}
else
{
var line1 = "";
} 

if (crmForm.all.address1_line2.DataValue!=null)
{
var line2 = crmForm.all.address1_line2.DataValue + '\n';
}
else
{
var line2 = "";
} 

if (crmForm.all.address1_line3.DataValue!=null)
{
var line3 = crmForm.all.address1_line3.DataValue + '\n';
}
else
{
var line3 = "";
} 

if (crmForm.all.address1_city.DataValue!=null)
{
var city = crmForm.all.address1_city.DataValue + '\n';
}
else
{
var city = "";
} 

if (crmForm.all.address1_stateorprovince.DataValue!=null)
{
var stateorprovince = crmForm.all.address1_stateorprovince.DataValue + ' ';
}
else
{
var stateorprovince = "";
} 

if (crmForm.all.address1_postalcode.DataValue!=null)
{
var postalcode = crmForm.all.address1_postalcode.DataValue + ' ';
}
else
{
var postalcode = "";
} 

if (crmForm.all.address1_country.DataValue!=null)
{
var country = crmForm.all.address1_country.DataValue + '\n';
}
else
{
var country = "";
} 

/*
create contents of text box
*/
crmForm.all.new_addressdetails.DataValue =
name.toString() +
addressname.toString() +
addresstypecode.toString() +
line1.toString() +
line2.toString() +
line3.toString() +
postalcode.toString() +
city.toString() +
stateorprovince.toString() +
country.toString();
crmForm.all.new_addressdetails.ForceSubmit = true; 

/*
Change properties of the text box
*/
/*
make field readonly
*/
crmForm.all.new_addressdetails.readOnly = true;
/*
make background transparant
*/
crmForm.all.new_addressdetails.style.backgroundColor='transparent';
/*
hide scrollbar
*/
document.all.new_addressdetails.style.overflow='hidden';
/*
make font bold
*/
document.all.new_addressdetails.style.fontWeight='bold';
/*
change left padding
*/
document.all.new_addressdetails.style.paddingLeft='10px';
/*
make borders invisible
document.all.new_addressdetails.style.border='none';
*/

new_changeaccountinformation onChange script to hide and show the Account Information section:

if (crmForm.all.new_changeaccountinformation.DataValue == "1")
{
crmForm.all.name_c.parentElement.parentElement.parentElement.style.display ='block'
}
else
{
crmForm.all.name_c.parentElement.parentElement.parentElement.style.display ='none'
}

new_changeaddress onChange script to hide and show the Address Details section:

if (crmForm.all.new_changeaddress.DataValue == "1")
{
crmForm.all.address1_name_c.parentElement.parentElement.parentElement.style.display='block'
}
else
{
crmForm.all.address1_name_c.parentElement.parentElement.parentElement.style.display='none'
}
Tagged as: , , ,

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars (1 votes, average: 6.00 out of 7)
Loading ... Loading ...

Querying on checkbox values

Via the Advanced Find it is very easy to query on all kind of things within MS Dynamics CRM. The functionality is great. The only thing is, it does not always give you the right result. This has nothing to do with the Advanced Find functionality but everything with understanding the underlying Microsoft SQL Server Database.
If you use a bit (checkbox) value, you can assume there are only two values: YES and NO. But this is incorrect. In the database 3 values can be used for a bit value: YES, NO and NULL. On the forms in CRM the NO and the NULL are perceived the same, both as NO. When you query a checkbox, with the query ‘Checkbox Equals No’, you will only get the records where the bit is actually NO. The records with a NULL value in the database are not included in the result. In case you want the NO and the NULL values, you can better query ‘Checkbox Does Not Equal Yes’.

In other words I recommend to query always on the positive (YES) value when querying a checkbox.
So I recommend ‘Checkbox Equals Yes’ and ‘Checkbox Does Not Equal Yes’.

Tagged as: , , ,

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars (1 votes, average: 7.00 out of 7)
Loading ... Loading ...

Make website field clickable

On the standard contact form the field website is not clickable. You have to copy the url to a browser address bar. This is probably because of the synchronization with outlook.
To make the field clickable on the form you can add the following code to the OnLoad of the Contact form.

/*** make website field clickable***/
//change color and make underlined
crmForm.all.websiteurl.style.color = "#0000ff";
crmForm.all.websiteurl.style.textDecoration = "underline";
/* Double Click website to Open*/
function CreateURL(WebSite)
{
	return function()
	{
		if (WebSite != null && WebSite.value.length > 0)
		{
			var prefix = WebSite.value.substring(5, 0);
			if (prefix == "http:")
			{
				window.open(WebSite.value);
			}
			else
			{
				window.open("http://" + WebSite.value);
			}
		}
	}
}
crmForm.all.websiteurl.attachEvent('ondblclick', CreateURL(crmForm.all.websiteurl));
Tagged as: , ,

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars (No Ratings Yet)
Loading ... Loading ...
Page 1 of 212
  • Recent Posts

  • Ratings

  • Archive

  • Admin

  • Cloud

  • Microsoft Certified Professional

  • About & Contact