Wednesday, October 28, 2015

Sitecore 8: Sending reminder mails without knowing

Environment: Sitecore 8.o rev 150621

When I setup new instance on one of our production environment, I have experienced the following message on Sitecore log files.

ManagedPoolThread #14 11:24:06 INFO Executing email reminder task
ManagedPoolThread #14 11:24:06 INFO Parameters: <r><to>name@company.com</to><txt>Demo reminder</txt></r>
ManagedPoolThread #14 11:24:06 INFO Sending reminder mail (to: 'name@company.com', from: 'name@server.net', subject: 'Reminder from Sitecore')
ManagedPoolThread #14 11:24:06 INFO Using mail server: 'smtp.company.com'

When this message logged to the Sitecore logs it says there are some unwanted reminder mails are sent to the Sitecore content authors. 
The reminder emails sending are not expected by the content authors and they are usually outdated.

We have raised a Sitecore support ticket and their suggestion is to manually change the values which responsible for this in the database.


To change the values within the Sitecore database: 


1. Login to your website SQL Server.

2. Go to the website's Sitecore core database.
3. Select * From Tasks
4. Check the resulting table's 'Pending' column.
5. Check if there are any 1 's (Which means reminders are sending)
6. Change required values to '0' using the bellow query.
    Update [Tasks] Set Pending = 0; (This will make all the values to 0, so use whatever the where clauses you want and run the query.)


Monday, October 19, 2015

Sitecore 8 - System.ArgumentException: Directory does not exist. Parameter name: directoryVirtualPath

Environment: Sitecore 8 rev. 150621

When I work one of our projects. I have experienced the following error:

Directory does not exist.
Parameter name: directoryVirtualPath


NOTE: Get the latest Sitecore databases from your CI or Release environment which already installed the required Sitecore modules.

The error message describes there is a required directory (folder) missing in your solution.
If you have copied the Sitecore correctly this can be due to not coping a required Sitecore module.

Go to the config files of your solution to figure out what are the Sitecore modules that used in your solution.
Since the solution is not working and you can't access the Sitecore desktop to install modules, extract required module and copy the files and folders inside \package\files and paste to your website root.

Since your database has the required items of the Sitecore modules, copying the files of the module is just enough. 

This should do the work.

Monday, September 28, 2015

Sitecore WFFM - Add to Contact List save action not showing contact lists

Environment: Sitecore 8.0 rev 150621

Sometimes when working with the WFFM on Sitecore you might experience the following issue with the 'Add the contact to contact list' save action.


This is because of following:
1. You have no lists created.
2. You have lists but it is not visible in the List Manager.

To ensure this go to the 'List Manager'/


In my case, I have list created but my List Manager won't show me anything.

In this case, go to the Sitecore Control Panel and Select the 'Indexing manager' under the 'Indexing' section.
Select the 'sitecore_list_index' as bellow image.


Then click 'Rebuild'

After it is done, visit the 'List Manager' again. If you have created some list earlier, it must appear in here now as bellow.


Then go to your form's save actions. Select the 'Add to Contact List' save action. Go to Edit.
Then you can see your lists are appear on that save action.



Monday, September 7, 2015

Fixing Sitecore Licence Issue

When working with Sitecore you might face issues like bellow:

At this point your site will not be accessible and you can't run the showconfig.aspx as well.
If you know the location of the data folder (where Sitecore licence live) of your site, you can directly copy the new licence file to that location.

Sitecore default data folder is /App_Data/Sitecore.
But sometimes your website can have a config that override this location for a different location.
In a situation like that we can get the help of Sitecore Config builder. You can download and get to know more about this tool from here.

1. Download the Sitecore COnfig Builder and Unzip to a folder you like.

2. Get the App_Config folder and web.config file of your broken site to a preferred location. Keep the both App_Config folder and web.config file in the same folder.

3. Open Sitecore.ConfigBuilder.Tool.exe 


4. Click on 'Browse' and select the web.config from the location that you have save them.

5. Select 'Save files into the same folder' if you want (this is easier actually ;) ) and click on 'Save'.

6. This will create some couple of files on the location you ask to create.

7. You can find a file called showconfig.xml

8. Open it and find the following section:
<sc.variable name="dataFolder" value="{ Your data folder location }" patch:source="DataFolder.config" />

9. Go to that location. Make sure it has a licence file.

10. Copy your latest Sitecore licence file (copy and replace).

Your site will be now up and running. 

Thursday, September 3, 2015

Working with SItecore MongoDB databases

Sitecore introduce mongoDB on Sitecore 7.5 for handle their Sitecore Experience database (xDB).
When you working with Sitecore mongoDB you have to know how to backup and restore mongoDB databases.

Backup Sitecore mongoDB database

The simple way is to backup as dump.

Go to mongoDB folder/bin from command prompt.
D:\MongoDB\bin>

Backup single database to a different location
D:\MongoDB\bin>mongodump --out \{folder}\{folder}\ -db {database_name}

Ex- D:\MongoDB\bin>mongodump --out E:\backups\ -db mongo_old_db

Sometimes there can be an error like bellow:


Then use D:\MongoDB\bin>mongodump --out \{folder}\{folder}\ --db {database_name}

Read more on mongodump from here

Restore Sitecore mongoDB databse

You can rename the database if you want when restoring.

Go to mongoDB folder/bin from command prompt.
D:\MongoDB\bin>

Restore single database with a different name
D:\MongoDB\bin>mongorestore -d {new_database_name} {old_database_backup_path}

Ex- D:\MongoDB\bin>mongorestore -d mongo_new_db D:\backups\old\mongo_old_db

Read more on mongorestore from here

Read more on other backup and restore methods in mongoDB from here

NOTE: Always use folder paths and folder names without spaces and special characters.
Otherwise use the path within double quotes ("").

To view database tables and data in a graphical way, you can use a tool like RoboMongo.
Read and download RoboMongo from here.


Monday, August 31, 2015

Sitecore logs - How to find errors and issues

Environment - Sitecore 8.0 rev. 150621

Hi all,

If you worked as a pure .NET developer and you moved to work with Sitecore you will get the same problems as I had few months back from now.

"How am I going debug this ???"
"Where are the errors ??"
"How can I find the errors on my site and any function ???"

Those are my questions when I start Sitecore. Since Sitecore is a product and it uses it's own dll files to perform it's internal tasks we can't debug the classes inside the Sitecore like we do in a pure .Net project. But Sitecore provide a way to take you out from these troubles. Sitecore log files.
You can find these log files on your data_folder/App_Data/Sitecore/logs

Sitecore uses Apache's log4net to create log files. You can have a read on log4net from here.

There are 3 types of log files

1. Standard log (log)
This is the most common log. This log will log errors, warnings, information, etc according to your settings.

            Verbose log
This logging feature is disabled by default. This feature is designed to provide search index configuration and provide more rich and more detailed version of the problem. You can enabled this feature by removing the '.example' from the 'Sitecore.ContentSearch.VerboseLogging.config.example' cofig files inside the {your_site_folder}/App_Config/Include

* Verbose Log should enable only on special scenarios and never run long period of time specially on production environments. Since verbose logger would creates an extremely large log file, it can cause to a performance issue.

2. Crawling log (Crawling.log)
Track information about indexing operations. (I'll talk about Sitecore Indexing in latter session)

Following shows an example of  a crawling log.

11704 13:22:13 INFO  [Index=social_messages_web] Initializing SitecoreItemCrawler. DB:web / Root:/sitecore/social/Messages
11704 13:22:13 INFO  [Index=sitecore_analytics_index] Initializing TimedIndexStrategy with interval '00:01:00'.
11704 13:22:13 INFO  [Index=sitecore_core_index] Initializing IntervalAsynchronousUpdateStrategy with interval '00:01:00'.
11704 13:22:13 INFO  [Index=sitecore_master_index] Initializing SynchronousStrategy.
11704 13:22:13 INFO  [Index=sitecore_web_index] Initializing OnPublishEndAsynchronousStrategy.
11704 13:22:13 FATAL [Index=sitecore_web_index] Initialization of OnPublishEndAsynchronousStrategy failed because event queue is not enabled.

By default the Crawling log is set to output logs on 'INFO' level.

3. Search log (Search.log)
Shows queries that were generated and run.

Following shows an example for a search log.

3724 13:47:58 INFO  ExecuteQueryAgainstLucene (sitecore_analytics_index): type:contact - Filter :
3724 13:47:58 INFO  ExecuteQueryAgainstLucene (sitecore_analytics_index): type:contact - Filter :
3724 13:47:58 INFO  ExecuteQueryAgainstLucene (sitecore_analytics_index): +contact.contactid:a2a2d13f8603400d864c7914aadd593d +type:visit - Filter :

To get the full level details of the content search you have to enable the 'Sitecore.ContentSearch.config' and change the logging level to 'DEBUG'.

You can find all the configurations related to these log files in the <log4net> section of the web.config file.
According to the requirement you can increase or decrease the level of the log. The following provides the logging levels minimum to high.

  1. OFF - nothing gets logged 
  2. FATAL
  3. ERROR
  4. WARN
  5. INFO
  6. DEBUG
  7. ALL - everything gets logged

* Your log levels can be changed when you enabled the Verbose logging.

Sitecore will create logs for each day. If you want fresh logs on a day, you can restart the site from Microsoft IIS Manager. Then Sitecore will create logs with date and number. (ex- log.20150828.132211.txt)

* If you are still like to see the .Net errors on the page when you are testing you can turn off the custom errors on the web.config file.

Change <customErrors mode="On"  /> to <customErrors mode="Off"  />




Tuesday, August 18, 2015

Sitecore Web Forms for Marketers Save Actions: The action does not exist

Environment - Sitecore 8.0 rev. 150621

Sitecore Web Forms for Marketers Save Actions are used to provide functionalities which need to perform when a certain form is getting submitted.


When dealing with the save actions on Sitecore 8 there is an issue with the graphical interface on save action management. Therefore some save action which removed from the form can be still exist in the save actions raw values.
You can find this by checking on the Sitecore log files. If there is a such issue, in the Sitecore logs you can find a error similar bellow.

6092 05:46:44 WARN  Web Forms for Marketers : The '{D866FC78-08F5-4AAA-975C-26E991B1D881}' action does not exist

Follow these steps to find this save action exists.

1. Go to your Sitecore instance and go to Web Forms for Marketers, go to the form which throwing the error and turn on the 'Raw values' from the 'view' tab


2. Copy the value (xml) of the 'Save Actions' field of the 'Submit' section to a notepad.

3. Copy the Sitecore item. (according to the log message the item is - {D866FC78-08F5-4AAA-975C-26E991B1D881})

4. Find the copied Sitecore item on the notepad.
    If the item is found on the notepad you have to remove it from that xml.

    Remove unwanted save action from xml.

    4.1. Create a new form.
    4.2. Add the other save actions on your form to the newly created form.
    4.3. Copy the value (xml) of the 'Save Actions' field of the 'Submit' section of the newly created form.
    4.4. Paste it to the 'Save Actions' field of the 'Submit' section form that throwing errors.
    4.5. Do the required changes to the save actions.