Summary:

Version: 7.2a
Area: Exchange Integration

Steps to Reproduce:

1. Install a v7.0 copy of CRM. Set up your users' email addresses.
2. Upgrade to v7.2. Set up the Exchange integration.
3. Create a new appointment in CRM. Your user should be the organizer.
4. Synch with Exchange.

Expected result:

Your appointment should synch - your user is an attendee.

Actual result (please include error message):

The Appointment is not synched. Error in skippedItemsCRMToExchange.log:

WARN  [http-apr-11009-exec-7]: 30-Sep-2013 10:59:37.124 [admin] comm_communicationid: 12345, subject: Test - CRM to EWS, organizer: 1, startDate: 2013-09-30 10:55:00.0, endDate: 2013-09-30 11:25:00.0 Reason: OrganizerNotOnAttendeeList

More info:

The issue was in a comparison being done on the user's email address. On a vanilla v7.2 system, the user_emailaddress column is set to an nvarchar(255). On older CRM versions, the field is an nchar(255). The major difference between the two is that an nchar field will pad out the full width of the column using spaces, whereas an nvarchar field will only store the actual value.

The different will look something like this, for a 50 character column.

"This is nchar data.                               "
"This is nvarchar data."

Note the padding on the nchar column.

The comparison we were running looked a little like this:

if ((organizer.equalsIgnoreCase(emailAddress.getEmailAddress())) && (!emailAddress.isDeleted())) {
    return;
}

You can see that it does a case-independent comparison. It's not clear from the above whether or not the organizer string or getEmailAddress() method contain the padded spaces – as it turns out, they do. Doing a string comparison, spaces count. So, you get an error.

This was raised as a bug, and was resolved in the 7.2c patch. Should the script resolving the issue fail in a CRM patch release (possibly due to an index on the user_emailaddress column), the workaround may still need to be aplied to systems on a later patch

Workaround:

Our general policy is to not update the user's database column types as part of an upgrade, but in this case it results in not being able to do a comparison on attendees' email addresses on upgraded systems.

WARNING: The techniques or examples contained in this article are for illustrative purposes only, and have not been tested in a production environment. The techniques or examples used are not necessarily supported features of SAGE CRM, and may not have been previously tested or implemented on a production environment. Before attempting to implement any of these techniques or examples on a production environment, they should be tested thoroughly, as use of these techniques may cause unexpected behaviour. SAGE can accept no responsibility for any issues arising from the use of these techniques. Please ensure that you back up your database and application fully before implementing any changes of this nature.

Setting the user_emailaddress column to be an nvarchar(255) will resolve the issue.

alter table users alter column user_emailaddress nvarchar(255)

update users set user_emailaddress = rtrim(user_emailaddress)