Archive for June, 2008

Querying on checkbox values

Tuesday, June 24th, 2008

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’.

Hide “Add Existing” buttons

Wednesday, June 11th, 2008

A couple of times a month I read the question on a forum how to hide/disable the “Add Existing” button. Unfortunately nobody comes up with a suitable solution.Within my current project someone asked me the same question. My first reaction was that is not possible within the borders of Microsoft support we have committed ourselves to. Some moments later I realized the “Add Existing” button we were talking about was displayed in an iFrame. That is a different story.Based on a previous post, I am able to hide elements in an iFrame and this includes the “Add Existing” button. See picture below (for original form see other post).

add_existing.gif

The script I added is simple:

//hide the Add Existing button
if (objWindow.document.all._MBtoplocAssocOneToMany4200AccountActivityPointers !=null)
{
objWindow.document.all._MBtoplocAssocOneToMany4200AccountActivityPointers.style.display ='none';
}

 In my previous post you can read how to use it.

I know it does not solve the problem of hiding the “Add Existing” button on the Associated views, but in some cases it can be a way out.