Tuesday, November 30, 2010

Change max publish duplicate detection rules

We have an on premise CRM 4.0 rollup 10 deployment, and our client have requested a number of duplicate detection rules upon leads. We started the development of the rules but when we tried to publish then the system informed us that only 5 rules where allowed per entity.

After some googling we found a solution to our problem. In MSCRM_CONFIG database table DeploymentProperties witch holds the constraint of max 5 rules per entity. With a simple query and a full restart of IIS – CRM Asynchronous Service we were able to publish more than 5 rules.

The query for max 7 duplicate detection rules was:

update DeploymentProperties set
      IntColumn = 7
where ColumnName = 'DupMaxPublishedRules'

The above solution is not supported by Microsoft and can cause serious performance issues, but in our case (the number of leads is relatively small) we didn’t have any problem.

Monday, November 8, 2010

Deserialization failed: The 'DataType' attribute is not declared

I faced the above problem when I tried to open a report in Visual Studio 2008. I had edited the report many times in the past and I don’t know what caused the problem. In my opinion it must be a bug of the report builder of Visual Studio 2008. I opened the xml definition of the report and compared it with a version of the report witch was working. The difference can be found below.

Working xml

      <ValidValues>
        <ParameterValues>
          <ParameterValue>
            <Value>-1</Value>
            <Label>Less Than</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>0</Value>
            <Label>Equal</Label>
          </ParameterValue>
          <ParameterValue>
            <Value>1Value>
            <Label>Greater Than</Label>
          </ParameterValue>
        </ParameterValues>
      </ValidValues>

Not working xml

      <ValidValues>
        <ParameterValues>
          <ParameterValue>
            <Value DataType="Integer">-1</Value>
            <Label>Less Than</Label>
          </ParameterValue>
          <ParameterValue>
            <Value DataType="Integer">0</Value>
            <Label>Equal</Label>
          </ParameterValue>
          <ParameterValue>
            <Value DataType="Integer">1</Value>
            <Label>Greater Than</Label>
          </ParameterValue>
        </ParameterValues>
      </ValidValues>


I removed the DataType attribute and everything worked fine

Thursday, November 4, 2010

Sql2k8 (x64) fails on PassPidBackFromComponentUpdate 0x80070006 (E_HANDLE)

We were trying to install sql server 2008 from an MSDN subscription and we got an error message 0x80070006 (E_HANDLE). After some googling we found that is a MSDN bug and the solution to the problem was in the product key selection to simply select the "Specify a free edition" radio button without changing the shown PID, then reselect the "Enter the product key" radio button (again without changing the PID). That was crazy... The original post of the solution can be found here.

Monday, October 25, 2010

User ID assosiated with the current record is not valid

We had a CRM 4 rollup 10 installation in a on premise deployment and we tried to make an image of the deployment and change the name of the computer. At the end of the procedure we couldn’t login to the original server and the server returned the following message User ID associated with the current record is not valid.
Well the problem that caused this message was that the machine principal in active directory had become invalid. We fixed the problem be making the following steps:
1. We detached the server machine from the domain and we made sure that the principal of the server was deleted from AD.

2. We attached again the machine to AD.

3. We added the newly created machine principal to the following crm security groups: PrivReportingGroup, SQLAccessGroup and PrivUserGroup (CRM security groups of deployment)

After that we were able to login again:-)

Tuesday, June 1, 2010

How to iterate on Tablix rows?

I have implemented a custom renderer for sql server 2005 in order to send direct information from a report to Microsoft Dynamics CRM. When they announced me that I have to port the solution to sql server 2008 I encountered the following problems:

1. The namespace have been changed from

Microsoft.ReportingServices.ReportRendering;

to

Microsoft.ReportingServices.OnDemandReportRendering;

2. Control Table did not exist and had been replaced with Tablix. The iteration of table rows was easy, and I have implement it like this

Table table = reportItem as Table;

for (int j = 0; j < table.DetailRows.Count; j++)
{
    TableDetailRowCollection tableDetailRow = table.DetailRows[j];
    for (int k = 0; k < tableDetailRow.Count; k++)
    {
       
    }
}

But the Tablix control does not work like this. In order to iterate through the tablix rows I implemented the following code

Tablix table = reportItem as Tablix;                                               

int pos = -1;
foreach (TablixMember memberDef in table.RowHierarchy.MemberCollection)
{
    pos++;
    if (memberDef.IsStatic)
        continue;
    TablixDynamicMemberInstance instance = (TablixDynamicMemberInstance)memberDef.Instance;
    instance.ResetContext();
    while (instance.MoveNext())
    {
        foreach (TablixCell tableCell in table.Body.RowCollection[pos])
        {
            if (tableCell.CellContents.ReportItem is TextBox)
            {
                ...
            }
        }                               
    }
}