Pretty simple and before I dig into it it's probably easier to find out what im failing to do.
We have created an integration bus that will keep CMS Users in sync in a 3rp party database.
We have created an integration class that uses the following line to subscribe to user updates and create a task in the outgoing queue
SubscribeToObjects(TaskProcessTypeEnum.AsyncSimple, PredefinedObjectType.USER);
We have added some simple logic to bypass admin users and any other users we are not interested in synchronizing.
The code for integration currently looks like
if (infoObj.ObjectType == PredefinedObjectType.USER)
{
UserInfo userInfo = infoObj.MainObject as UserInfo;
if (userInfo.IsGlobalAdministrator)
{
result = IntegrationProcessResultEnum.OK;
}
else
{
//CREATE SalesForce Contact and send to sales force
Contact contact = new Contact();
contact.FirstName = userInfo.FirstName;
contact.LastName = userInfo.LastName;
contact.Email = userInfo.Email;
contact.Id = userInfo.GetStringValue("salesforceid", "");
string salesforceid;
if (Connector.GetCurrent().WriteContactToSalesforce(contact, out salesforceid))
{
result = IntegrationProcessResultEnum.OK;
errorMessage = "Process OK";
//if we get an id back it should be saved to the UserInfo
if (!string.IsNullOrEmpty(salesforceid))
{
userInfo.SetValue("salesforceid", salesforceid);
userInfo.Update();
}
}
}
It will not stay like this I am just prototyping and trying to learn the basics.
The call to userInfo.Update which I don't believe should fail throws an exception.
[BaseIntegrationConnector.ProcessInternalTask]: Error processing task. Original message: [DataConnection.HandleError]: Query: UPDATE CMS_UserSettings SET [UserNickName] = @UserNickName, [UserPicture] = @UserPicture, [UserSignature] = @UserSignature, [UserURLReferrer] = @UserURLReferrer, [UserCampaign] = @UserCampaign, [UserMessagingNotificationEmail] = @UserMessagingNotificationEmail, [UserCustomData] = @UserCustomData, [UserRegistrationInfo] = @UserRegistrationInfo, [UserPreferences] = @UserPreferences, [UserActivationDate] = @UserActivationDate, [UserActivatedByUserID] = @UserActivatedByUserID, [UserTimeZoneID] = @UserTimeZoneID, [UserAvatarID] = @UserAvatarID, [UserBadgeID] = @UserBadgeID, [UserShowSplashScreen] = @UserShowSplashScreen, [UserActivityPoints] = @UserActivityPoints, [UserForumPosts] = @UserForumPosts, [UserBlogComments] = @UserBlogComments, [UserGender] = @UserGender, [UserDateOfBirth] = @UserDateOfBirth, [UserMessageBoardPosts] = @UserMessageBoardPosts, [UserSettingsUserGUID] = @UserSettingsUserGUID, [UserSettingsUserID] = @UserSettingsUserID, [WindowsLiveID] = @WindowsLiveID, [UserBlogPosts] = @UserBlogPosts, [UserWaitingForApproval] = @UserWaitingForApproval, [UserDialogsConfiguration] = @UserDialogsConfiguration, [UserDescription] = @UserDescription, [UserUsedWebParts] = @UserUsedWebParts, [UserUsedWidgets] = @UserUsedWidgets, [UserFacebookID] = @UserFacebookID, [UserAuthenticationGUID] = @UserAuthenticationGUID, [UserSkype] = @UserSkype, [UserIM] = @UserIM, [UserPhone] = @UserPhone, [UserPosition] = @UserPosition, [UserBounces] = @UserBounces, [UserLinkedInID] = @UserLinkedInID, [UserLogActivities] = @UserLogActivities, [UserPasswordRequestHash] = @UserPasswordRequestHash, [UserWebPartToolbarEnabled] = @UserWebPartToolbarEnabled, [UserWebPartToolbarPosition] = @UserWebPartToolbarPosition, [UserInvalidLogOnAttempts] = @UserInvalidLogOnAttempts, [UserInvalidLogOnAttemptsHash] = @UserInvalidLogOnAttemptsHash, [UserAvatarType] = @UserAvatarType, [UserAccountLockReason] = @UserAccountLockReason, [UserPasswordLastChanged] = @UserPasswordLastChanged WHERE [UserSettingsID] = @UserSettingsID: caused exception: Conversion failed when converting date and/or time from character string.
I do of course understand the exception but instead of me trying to hack around the object does anyone know why this is happening?
Thank you