Thursday, January 7, 2016

Sitecore: Sending mails with local MTA

When you working with Sitecore EXM you obviously need to test sending mails (review) creted using EXM.
Sometimes you might get the following error in a error strip when try to send email from EXM.

Your Sitecore App Center credentials are incorrect, or you do not have a valid license. Correct your credentials in <a href='/sitecore/shell/Applications/SitecoreApps/Loader.aspx' target='_blank'>Sitecore App Center</a> or contact Sitecore Customer Service.



This is because Sitecore EXM is using the Sitecore AppCenter's Mail Transfer Agent (MTA).

If you are using the AppCenter MTA (Mail Transfer Agent), then you can sign into the AppCenter and let the AppCenter MTA to do the job for you.

In my case I don't won't this. I need to use my own MTA.
To do this you have to do the following:
1. Set the UseLocalMTA value to 'true' (default is false).
2. Set your own SMTP settings.

Q: Where is this 'UseLocalMTA' setting is ? How can I find it ?
A: Simple. Get a configurations of your website using this URL: 
http://<your_host_name>/sitecore/admin/showconfig.aspx
Then Search for 'UseLocalMTA'.
It will find you the following configuration.
<setting name="UseLocalMTA" value="false" patch:source="Sitecore.EmailExperience.ContentManagement.config"/>

Go to the patch.source using the file system of your website.
Then change the UseLocalMTA value to 'true'.




Tuesday, January 5, 2016

Sitecore 8.0 rev 150621 - Rebuild Reporting Database

When I'm working with our Sitecore integrated website, I noticed that the recent visitor details are not getting recorded in the Sitecore Experience Profile. The reason is to this is the Sitecore reporting database has stopped working or broken.

These are the steps that I followed to rebuild the Sitecore reporting database.

Pre-Steps

1. Get a fresh Sitecore analytics database from a fresh Sitecore instance. Attach it to the SQL Server using a proper name.

2. Get the WFFM post installation sql script (WFFM_Analytics.sql) and run it against the analytic database. If your website has installed the WFFM this sql script can be found inside [site root]\Website\Data

3. Get the ECM post installation sql script (Sitecore.EmailExperienceManager.sql) and run it against the analytic database.

4. Download and execute the WFFM.StoredProcesdure.AddFormStatisticsByContact.sql from https://kb.sitecore.net/en/Articles/2015/06/23/16/27/282795.aspx against the analytic database and do the requested change in the Sitecore.Analytics.Processing.Aggregation.config file.

5. Set db_owner user permission to the user for the analytic database.

6. Change the ConnectionString.config. Set the reporting.secondary property to the newly attached analytic database. Keep the reporting database to the existing database.

7. Change the time to clear the storage setting in Sitecore.Analytics.Processing.Aggregation.config file as bellow.

<reportingStorageManager type="Sitecore.Analytics.Aggregation.History.ReportingStorageManager" singleInstance="true">
        <TimeToClearStorage>0.00:05:00</TimeToClearStorage>

NOTE: Within this time we have to run couple of sql scripts against the analytic database. So make sure you set the time you need. (Rebuilding Steps 3)

Default : <TimeToClearStorage>0.00:01:00</TimeToClearStorage>

8. Delete content inside <DataFolder>/indexes/sitecore_analytics_index folder.

9. Restart the IIS website.

10. Ensure that the Segments table is not empty in current "reporting" database by running SELECT * FROM Segments against the current reporting database.

NOTE: If this table is empty, please copy data from a clean Sitecore reporting database or run /sitecore/admin/redeploymarketingdata.aspx

Example Query :
INSERT INTO DestinationDB..Segments
SELECT * FROM SourceDB..Segments
https://community.sitecore.net/developers/f/9/t/1028

11. Manually change the Deploy Date for the segment definitions in the Segments table of your reporting database to the date earlier than the first visit from your historic data was performed.

NOTE: if the deploy date is set to earlier year/date, then this step is already done.

12. Make sure the following config files are enabled.

  • Sitecore.Analytics.Processing.Aggregation.Services.config
  • Sitecore.Analytics.Processing.Services.config


Rebuilding Steps

1. open the rebuild reporting database history processing page in new browser window using the link: <hostname>/sitecore/admin/RebuildReportingDB.aspx

2. Click Start.

3. In the Rebuild Reporting Database page, when you see "WaitReadyToReceiveData" status, copy the following marketing definition tables from the primary to the secondary reporting database:

  • CampaignActivityDefinitions
  • GoalDefinitions
  • OutcomeDefinitions
  • MarketingAssetDefinitions
  • Taxonomy_TaxonEntity
  • Taxonomy_TaxonEntityFieldDefinition
  • Taxonomy_TaxonEntityFieldValue
Use the bellow sql format to execute the data.
INSERT INTO <DestinationDB>..CampaignActivityDefinitions
SELECT * FROM <SourceDB>..CampaignActivityDefinitions

4. Wait till "Process State : Completed".

Post-Steps

Do the following steps after status get Completed.

1. Change "reporting" connecting string "Database" attribute to Sitecore_Reporting_Secondary database and comment "reporting.secondary" connection string.

2. Check whether the TreeDefinitions table of your reporting database contains any records.

NOTE: If this table is empty, please copy data from the TreeDefinitions table of the current or clean Sitecore reporting database

3. Change the pre-step 7 to default (0.00:01:00)

4. Go to the Sitecore Experience Profile and check it contains the latest visit details.


ISSUE

Sitecore analytic database getting broken time to time.

This happen to database which has more than 20 contacts in the xDB.
To avoid this apply the patch provide by Sitecore from https://kb.sitecore.net/articles/440768











Thursday, December 10, 2015

Sitecore EXM Message creation links are not responding

Sitecore version: 8.0 rev 150621
EXM version: 3.0 rev 150429

When I'm working with a Sitecore EXM module I experienced the email creation links are not working in the EXM. The links in the below image.



The reason for happening this is, some values and items required to EXM has been removed from the Core database.

1. To solve this problem, setup a vanilla installation of Sitecore using the SIM (Sitecore Instance Manager) tool. Read more about SIM from here.
2. Go to the instance's (website's) sitecore.
3. Change to Core database using the Sitecore Desktop.





4. Go to Content Editor --> Client --> Applications --> ECM --> Dialog Renderings 
Here is the place you can find the controls for dialog boxes links in the Sitecore EXM.

Find the following renderings:
a. OneTimeMessageRenderings
b. SubscriptionMessageRenderings
c. TriggeredMessageRenderings

5. Select each of them and do the following steps.

5.1. Go to 'Layout' section in the renderings item.

5.2. Go to View in the Sitecore ribbon and check 'Standard Fields' and 'Raw Values'.


5.3. The problem is with the 'Rendering' field.
Copy the 'Rendering' field value from your newly created Sitecore vanilla instance to this.

5.4. Do this for b and c also.

5.5. Save the changes.
When try to save there will be a warning message coming saying "The item "TriggeredMessageRenderings" contains broken links in these fields: - Renderings: "static" Do you want to save anyway?"



Ignore this message and click ok.

5.6. Go to EXM and test the links now. It should work.

CAUSE
The reason I assume for this problem is, I have remove the broken links in the Sitecore Core database using the removebrokenlinks.aspx which is provided by the Sitecore.
As you can see in the message, there are some broken links with these items.
So when I try to remove the broken links in the Core database using removebrokenlinks.aspx it removed these rendering values also.
So be careful when using the removebrokenlinks.aspx against the Core database.







Tuesday, December 1, 2015

Sitecore 8: Upgrade EXM 3.1 Update 1

In this blog post I'll explain how to upgrade the EXM to version 3.1 update 1.

Requirements:
1. Sitecore 8.0 rev. 150621 (Update-4) / Sitecore 8.0 rev. 150812 (Update-5).
2. Email Experience Manager 3.1.1 rev. 150811.update file.

You can download this from here. (You may require the permission to download this update).

1. Pre-Installation

1.1. Disable the following configuration files:
 Sitecore.EmailCampaign.config file.
 Sitecore.EmailCampaign.Speak.Server.Requests.config file.
 Sitecore.EmailCampaign.UI.config file.
 Sitecore.EmailCampaign.Dedicated.config file.
 Sitecore.EmailCampaign.Xtune.CD.config file.
 Sitecore.EmailCampaign.Xtune.Processing.config file.

1.2. Disable all scheduled tasks at the following locations:
 /sitecore/system/Tasks/Schedules/Email Campaign
 /sitecore/system/Modules/E-mail Campaign Manager/Tasks

NOTE: To disable the scheduled task, go to the task and clear the value in the 'Schedule' field in the item's Data section. (See image bellow)



1.3 Detached the Sitecore.EXM database (which is defined in the ecm.dispatch connection string)
NOTE: This is not available in Sitecore 7.5 and Sitecore 8.0. So if you are running on one of these versions you can skip this step.

1.4. If you are running on Sitecore 8.0 update 5 add the following configurations to your web.config file. (Else skip this step as well).

<dependentAssembly> 
   <assemblyIdentity name="MongoDB.Driver" publicKeyToken="f686731cfb9cc103" /> 
   <bindingRedirect oldVersion="0.0.0.0-1.8.3.9" newVersion="1.10.0.62" /> 
</dependentAssembly> 
<dependentAssembly> 
   <assemblyIdentity name="MongoDB.Bson" publicKeyToken="f686731cfb9cc103" /> 
   <bindingRedirect oldVersion="0.0.0.0-1.8.3.9" newVersion="1.10.0.62" /> 
</dependentAssembly>


2. Upgrade Installation

2.1. Go to the following URL.
http://<your_host_name>/sitecore/admin/UpdateInstallationWizard.aspx

2.2. Click 'Chose Package'



2.3. Select the package using the 'Brows' button. And continue by clicking on 'View package information'.


Then it will show you the package information.


Continue by clicking on 'Analyze and install the package'.

2.4. It is always better to analyse the package before install. Or you can directly click on Install.


If you select 'Analyze', it will show the details and click on 'Analysis results'.

This will show the problems with the analysis process. You need to look for red, blue and yellow signs.



2.5. Click on 'Install the package'.


2.6. You can check for the problems and if you feel ok you can close this page now.

3. Post-Installation 

After installing the update package, you should perform the following post-installation steps. Some of them can be already done for you. You just need to check every thing is ok.

3.1. Attach the Sitecore_Exm database to SQL server.
NOTE: You can find the file in the Data folder or, alternatively, in the Website\temp\ECM folder.

3.2. In the App_Config\ConnectionStrings.config file, add the SQL server connection string exm.dispatch
NOTE: Don't delete or overwrite the existing ecm.dispatch connection string because we need it to migrate the old data to the new database. (Migrate data from EXM monboDB to SQL database)

3.3. To migrate your existing email campaign data to SQL server, go to following URL.
http://<your_host_name>/sitecore/admin/MigrateCampaignData.aspx
If you don't have any data to migrate you can skip this step.

3.4. Now you can delete the old ecm.dispatch connection string in the /App_Config/ConnectionStrings.config file.

3.5. In the \App_Config\Include\EmailExperience\Sitecore.EmailExperience.Core.config file, replace the entire <ecmDataProvider defaultProvider="mongo"> section with the following section:

<ecmDataProvider defaultProvider="sql"> 
   <providers> 
      <clear/> 
         <add name="sql" type="Sitecore.Modules.EmailCampaign.Core.Data.SqlDbEcmDataProvider, Sitecore.EmailCampaign" connectionStringName="exm.dispatch"/> 
   </providers> 
</ecmDataProvider>

3.6. Remove the EXM httpHandler and handler sitecore_ecm_speak_request.ashx from the web.config file. (Simply delete the lines)

3.7. Remove the following files from all instances of EXM :
sitecore\shell\client\Applications\ECM\EmailCampaign.Client\Pipelines\UpdateMessagevariant\UpdateVariant.js
sitecore\shell\client\Applications\ECM\EmailCampaign.Client\Pipelines\UpdateMessagevariant

NOTE: Steps 3.5 and 3.7 might already done for you.

3.8. Your custom settings are not automatically ported to the new configuration file. If you have used any custom settings in the previous version and you want to apply them to EXM 3.1, make the necessary changes to the Sitecore.EmailExperience.ContentManagement.config file manually.

Ok, we are done with the installation.

4. Set the SMTP settings

In the Sitecore.EmailExperience.ContentManagement.config file set the smtp settings by changing the following configurations.

      <!-- SMTP server address (IP). -->
      <setting name="SMTP.Server" value="localhost" />

      <!-- Port number of the SMTP server. -->
      <setting name="SMTP.Port" value="25" />

      <!-- Domain for logging into SMTP server. -->
      <setting name="SMTP.LoginDomain" value="" />

      <!-- User name for logging into SMTP server. -->
      <setting name="SMTP.UserName" value="" />

      <!-- Password for access to SMTP server. -->
      <setting name="SMTP.Password" value="" />



Wednesday, November 18, 2015

Sitecore 8 - Document Manager is blank in Rich Text Editor

Environment: Sitecore 8.0 rev 150621

Sitecore Rich Text Editor allows to link a document to a link. So the idea is to download the linked document when the particular link is clicked.
To link the document you have to use the Sitecore Rich Text Editor (RTE). But when you trying to link the document using the Document Manager in the Sitecore RTE it is blank as bellow.



I have raised a Sitecore support ticket and this issue reported as a bug in Sitecore.

They have provided the following workaround to overcome this issue.

1. Open the /Website/sitecore/shell/Controls/Rich Text Editor/EditorPage.aspx file
2. Find the following text part and replace it:

MediaManager-ViewPaths="/media library"
TemplateManager-UploadPaths="/media library"

with this one:

MediaManager-ViewPaths="/media library"
DocumentManager-DeletePaths="/"
DocumentManager-ViewPaths="/"
TemplateManager-UploadPaths="/media library"

3. Clear browsers cache and try the issue again.
Let us know if you have any issue with the Document Manager.



Tuesday, November 17, 2015

SItecore 8 - Solve 'The model item passed into the dictionary is of type 'Sitecore.Mvc.Presentation.RenderingModel' error

When I work with Sitecore, I build Sitecore link databases to avoid some errors causing in our environment. But after building the core, master and web database links using the Sitecore Launchpad --> Control Panel --> Rebuild link databases I got the following error when I try to log in to the Sitecore back-end.

The model item passed into the dictionary is of type 'Sitecore.Mvc.Presentation.RenderingModel', but this dictionary requires a model item of type 'Sitecore.ExperienceAnalytics.Client.Mvc.Presentation.ExperienceAnalyticsLineChartViewModel'.

The reason for this issue is Sitecore does not clear the cache after it builds the link databases.
To solve this issue, do the following steps:
1. Login to the http://{your website}/sitecore/admin/cache.aspx
2. 'Clear all' cache.
3. Restart the website from IIS

But this a temporary solution.
I'm experience this issue time to time.
So when this error is throwing you have to redo the above steps.

Update

I created a Sitecore support ticket sine this error getting annoying and they provide a fix with some item changes. It include item changes in the core database.
If this problem arise in your environment I think it is better to raise a Sitecore support ticket with your databases.

Until Sitecore support come with a solution...

Don't worry, you don't have to be blocked with this.
In my case this error came in the Sitecore launch pad. So I was able to bypass the launchpad when I log in to the Sitecore by using the http://{website name}/sitecore/shell url.











Thursday, November 12, 2015

Sitecore 8: GeoIp not picking City, Region and Country

Environment: Sitecore 8.0 rev 150621

When we are testing our site to get visitor details, GeoIp does not tack City, Region and Country details of UK visitors. But visits received from Sri Lanka get the City, Region and Country details.

The reason for this is our QA visit the site from our internal network (the same network which our website is hosted).
Sitecore GeoIp does not track the City, Region and Country visits for the users coming from the internal networks.

To check this you can use an IP changing tool like Hide My Ass or Freedom.