Experience Sitecore ! | More than 200 articles about the best DXP by Martin Miles

Experience Sitecore !

More than 200 articles about the best DXP by Martin Miles

How to use Onero with Sitecore

As mentioned earlier, Onero interacts with Sitecore via Sitecore Item Web API (I also plan to ensure the data from Sitecore Entity Service in future) and this guidance will guide through this procedure step by step. In general, there are 4 major steps:

  1. Enable Item's WebAPI
  2. Creating pages in Sitecore and forms
  3. Configuring Onero
  4. Running and getting the results


1 .Enable Item's WebAPI

Sitecore Web API requires to be explicitly enabled on your Sitecore instance. If you haven't done this yet, enable it at Sitecore.ItemWebApi.config file. You will end up having something similar to below:


        StandardSecurity
        Read
        false

In order to test if Web API works - just paste http://your.host.name/-/item/v1/ into browser and you will get a response:

{"statusCode":401,"error":{"message":"Access to site is not granted."}}

No worries about error message - it is just telling that no anonymous access allowed to you Web API endpoint, which itself is working well and just served this request. Simply changing itemwebapi.allowanonymousaccess to true will return you valid response with data.

Once you paste this list link into Onero and hit Load Links button - you have everything ready o start the test.

When you click Load Links button, Onero calls Item Web API in Sitecore instance and populates Pages to process box with preview links out of the response. At the moment only items in preview mode are available.

More information about item Web API can be found in the official documentation.


2. Creating pages in Sitecore and forms

Now let's go into Sitecore Content Editor and prepare for more complex testing. I have got a clean Sitecore 8.1 just installed instance here. I use Experience Editor to create 2 web forms on Home page (of course, WFFM for Sitecore 8 should be installed as well)

To make things even simpler, let's take two pre-existing forms coming with WFFM package and set first form to display Success Message while the second to redirect to Success Page. Also create a confirmation page located at /Home/thanks to be referenced by Success Page mode and do not forget to publish website to bring these forms and pages into web database. If everything was done correct at this step, page will look something similar to below:



3. Configuring Onero

Now we want to test forms submission to ensure they function correctly. In Onero hit Forms button, then Add New. It will open Forms Editor where you need to set fields and values to submit the form with, also find and assign submit button and finally specify the results so that Onero can verify whether the page has been submitted correctly.


Also do not forget to check. If you want to delete or modify a form - double click its name.

.


4. Running Onero and getting results
While Onero runs, it changes links in the Page to process box to green or red depending on result status:

Clicking each or already processed URL opens Page results dialog, where all the rules and forms being executed on that specific page are listed:

Double clicking a rule or form opens its editor so it is quite convenient to preview and analyze what went wrong:


At the end of testing process Onero generated report file with all the statistics for that test run. You may find that in reports.csv file located at Results folder within a folder with current settings profile name (Transport for London in our case). The quickest way to access this folder is to click Settings button from main screen and then Open folder button - it will open resulting folder in a separate Explorer window,

Results.csv spreadsheet contains detailed information about what pages have run and how quickly, what rules and form have been executed and their status codes. If Verbose setting is checked - all the results will be displayed (as on a screenshot below), otherwise only failed will be mentioned in that spreadsheet (that is handy as it prevents from informational noise especially on websites with thousands links and dozens of rules.
First column shows pages being executed, the second - rules and forms run on that specific pages with corresponding statuses at third column. Addons statuses column shows overall status for rules and forms executed and Page Status column shows the statuses for the page itself. They may not match, for example the page has loaded correctly and has Successful Page status, while one of its rules broke resulting Addons status to fail. Time to load shows time in milliseconds taken for page to load, rules and form are not mentioned in that figure.


Hope this guide was helpful enough!

Welcome Onero Page Runner - now with Sitecore support!

I have not been posting for a while but there is an easy explanation - I was busy creating Onero Page Runner, which I have finally released. Now it is able to work with Sitecore Item Web API and also became open source project on GitHub.


What is Onero and what is it best for?

Onero is the lightweight testing solution. Is ideally fits for testing websites, especially frequently updated. It is very quick and easy to start, it does not require setting up and configuring complex Selenium frameworks and is best suitable for non-developer IT professionals, like managers, testers, content authors. However developers will also benefit from its simplicity and effectiveness.

Onero doesn't just simply load pages, but also executes simple JavaScript rules against them to verify compliance. As well as Rules it can also submit forms on pages (including authorization login forms to enter protected website areas), create screenshots of every single page visited and generate detailed report at the end of its journey.


Features:

  • Automatically retrieve list of pages to test from xml sitemap file of from Sitecore Item Web API
  • Iterate and verify every single page from the list
  • Create screenshot of every page visited for future inspection
  • Visualize the process in browser as it progresses
  • Run custom JavaScript rules to add additional check for some or all pages
  • Submit forms on the page with test values and verify the result
  • Work with protected areas of websites, that require pre-authorization 
  • Store multiple settings profiles and immediately switching between them
  • Realtime status updates as it goes
  • Detailed stats on execution after test fun finished

References:


Hope you find this tool very helpful!

StackOverflow: Sitecore Development on Mac using C#

Recently came across a question on StackOverflow "Getting started developing with Sitecore CMS on a Mac using C#".

This topic is quite interesting as I am working with Sitecore entirely from my own MacBook for the past few years so I've decided to share my experience with the community.


Being a follower of Apple products I got a top spec MacBook Pro 15" and was willing to make it my primary computer that is always with me and which I can instantly open and start coding. After trying to find the best approach to run the entire Windows server ecosystem on Mac, I turned to virtualisation. The best solution I've found is Parallels Desktop and it brings me better experience than I would expect to get working on a native Windows machine. So what makes this approach so effective?

  • Virtual machine is a file / directory on a disk drive, so copying / archiving allows me to persist current state of each virtual machine with the ability quickly backup and restore.
  • Derived from pervious: I have few pre-configured VMs with Visual Studio, SQL Server, IIS and and Sitecore as well as all development tools I may require. I can immediately return to work even in case of malware preventing me from doing that.
  • Parallels Desktop has tight integration between host and virtual machines. Shared clipboard and resources, it is possible to drag-drop files between Finder and Explorer. Many other sweeties as well are available with Parallels Desktop like Coherence mode, when windows entirely "melts" into mac, with Start button in the doc.
  • Ability to run multiple virtual machine in parallel - as many as your host Ma machine's performance allow.
  • All virtual machines are connected to host mac and each other by a virtual network, so now I am able to create web farms and clusters, sometimes entirely reproducing production environment configuration. Also it is possible to run bridge to external network so virtual machines get network parameters from external DHCP server and will be able to use corporate resources like source control etc. as normal machines would do.
  • Adequate performance and immediate response combined with well thought default settings make it easy to start.
  • Full screen mode entirely simulates usual windows experience
  • Ability to run other operation systems, for example you would want to run a Linux VM with MongoDB at the same network.
The only negative point about Parallels is that it is not free, the rest pretty perfect.

I would especially recommend Parallels Desktop to those who are just beginning working with Sitecore, as their chances to break anything by mistake are high enough, so the ability to create a restore point at every single moment is very beneficial for them.  

Sitecore XP 8 Upgrade for .NET Developers training - how was that?

Last Friday I have attended Sitecore XP 8 Upgrade for .NET Developers training in their London office. Unlike WND (4-days-long) training, to attend this 1-day-long UPG (upgrade) course, you have to already have one of previous full development certification courses done in past.

My major purpose for that training was to get clear understanding about both internals and integration of xDB with the rest of platform, mostly due to the big number of questions I prepared well in advance. I got everything what expected from that day!

There were only 4 trainees in the class; instructor was a guy who works for head office in Copenhagen - Alin Pârjolea - I knew him from community activity previously. Alin was just a bit shy in the beginning, admitting that is was his first time training to such an advanced auditory, but he did well and in an hour we found ourselves very involved in progressing the course and had nice engrossing conversations every break time.

Certification exam itself was typical - 40 questions from which you need to get 70% of correct answers, three options one and only of them is correct. However I found it to be quite complex. Many questions were worded quite confusingly - and the answers also were not quite easy to select from, sometimes we had two answers suiting question, sometimes none, so had to try to read between the lines and try thinking an questioner - what in fact was intended to ask. Also questions were from the whole Sitecore experience, not only what was covered by the upgrade course that day, so those who have little experience in general and little knowledge of best practices are very unlikely to pass that test. All four of us were quite experienced Sitecore developers and all four have passed, I personally got 82% of correct answers.

Also after the course Alin shared with us some best solutions already existing, that was how I knew about Sitecore Habitat - probably the best approach to moduleness, simplicity and extensibility for big and multisite Sitecore solutions.

So, I am quite glad I managed to get certified with Sitecore 8 and do recommend as well!


StackOverflow: Sitecore 8.1 bug - Launchpad brings HTTP 500 errors and several icons including FXM are missing

Question: today I have came across a question on StackOverflow regarding new 8.1 installation, I couldn't pass by:

I am installing Sitecore 8.1 with SIM and get several JavaScript errors coming from ajax request returning HTTP 500 errors when open my launchpad. Looking in the developers tools shows the message:

http://sitecore81/sitecore/api/ao/aggregates/all/786FBA3A4573445EA74504E3CA5E48C1/all?&dateGrouping=by-week&&dateFrom=26-07-2015&dateTo=26-10-2015&keyGrouping=collapsed

http://sitecore81/sitecore/api/ao/aggregates/all/7A9A483F195D4F96AD88473CD6854C4F/all?&dateGrouping=by-week&&keyTop=5&keyOrderBy=visits-Asc&dateFrom=26-07-2015&dateTo=26-10-2015&keyGrouping=by-key

"An error occurred when trying to create a controller of type 'AnalyticsDataController'. Make sure that the controller has a parameterless public constructor."
"at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request) at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"


That results to several icons missing from Launchpad, for example FXM.

That is exact point of my confusion I've experienced previous week, when Sitecore 8.1 was released. The explanation is below:

Previously in Sitecore 8.0, there was a very confusing situation, when many new features introduced in 8.0 required license for 8.0. Running those features with a license from one of previous Sitecore version did not block those features in UI from working, but still disabled them from inside of CMS. That lead to some confusing situations like I have described in one of my previous blog posts (see: blog post about FXM and question on StackOverflow) when user without appropriate license ran FXM and couldn't add parent placeholder - no relevant error message was said.

Now since 8.1, Sitecore decided to perform very reasonable structural changes to separate CMS from xDB and Analytics with licensing model. They introduces a new CMS-only mode when Sitecore can run without xDB and Mongo, just CMS features. Those who require to use xDB and Analytics in 8.1 now need to request explicit license allowing those features (using this URL). Otherwise their Sitecore instance will default to CMS-only mode. Sitecore download page contains a warning message regarding those changes:

Sitecore 8.1 now requires a license with the “Sitecore.xDB” key to enable all features of the Experience Platform. If your license file does not contain this key, Sitecore will default to Experience Management (CMS-only) mode. Any customers or partners with a license to Experience Platform should contact their account manager or login to SPN if they are missing this key.
But what about javasript errors? Well, that is definitely a bug. I have previously contacted Sitecore support in order to report a bug (issue Id 451464). Even if you explicitly enable CMS-only mode in Sitecore.xDB.config - you'll still get those AJAX errors. It looks that corresponding SPEAK controls try to call to Entity Services (web API) and it returns generic 500-error (internal server error) code, instead of something more specific like 403 (forbidden) and proper handling that code in JavaScript on client side.

Hope Sitecore fixes that shortly!

Update: I have received confirmation that having a license for xDB in 8.1 this issue does not occur.

Sitecore 8.1: what does new CMS-only mode mean?

That is the most wanted features that prevented my current organization from upgrade to Sitecore 8.0.

Having pretty complex infrastructure, big codebase, number of legacy code, wide range of third-party external services and data providers altogether with lack of human resources, it was not easy task to perform such a massive migration (from 6.6) at one time. The decision was taken to migrate part by part, starting with CMS itself without analytics, leaving xDB to second phase of upgrade.

But it happened that in 8.0 Sitecore had wired dependency on MongoDb and you had to have it regardless whether you plan to use analytics or not, even for content authoring environments. As we are limited in resources, we chose Sitecore xDB Cloud as the solution for our analytics, but it turned out that xDB Cloud was yet in beta, and business took a (conservative, as usual) decision to wait until it goes out of beta.

We consulted with Sitecore - they advised us about that issue would be sorted out in 8.1 - and that is exactly what happened. So, welcome CMS-only mode!

First of all, what is that?

As per documentation, CMS-only mode separates CMS functionality from analytics and drops CMS dependencies from xDB for those who don't need them. That also related to licensing changes in 8.1 - now there should be an explicit license for xDB functions (re-)issued for 8.1 and later, otherwise (and if you got license from any of previous versions) Sitecore will run in CMS-only mode by default.

There is a boolean configuration switch in Sitecore.Xdb.config file to enable / disable CMS-only mode:

<setting name="Xdb.Enabled" value="true" />

To draw a line between CMS and xDB, Sitecore revised all existing functions and introduces 3 modes of compatibility: Fully compatible, partly compatible and incompatible. As per documentation distribution looks like below:

Fully compatible:

  • Content editing in the Experience Editor
  • Device detection
  • IP Geo-location detection
  • Experience Explorer

Partly compatible

  • Campaign Creator – runs without analytics functionality
  • Commerce Connect – currently incompatible, but will run with limited functionality in future releases
  • Personalization – in-session personalization works, while personalization based on historical data is unavailable
  • Web Forms For Marketers – will provide a SQL solution in the future

Incompatible:

  • Content testing
  • Email Experience Manager
  • Experience Analytics
  • Experience Profile
  • List Manager
  • Path Analyzer
  • Segmentation

To my mind, introduction of CMS-mode is big step ahead; also such a separations of functions is logically cleaner than it was before in 8.0. For example previously you could run Sitecore 8.0 with old license and could even see and run, let's say Federated Experience Manager, but unless you had an explicit license for 8.0 you wouldn't be able to see any parent for placeholder. That was confusing and led to misunderstanding in past, but has more sense.

Hope you are going to get use of CMS-only mode and understanding how it works!

Sitecore 8.1 has been released!

As we have been waiting for it, Sitecore 8.1 is now released. That is a feature version, and it has such a massive what's-new and improvements list, that it may take you just 20 minutes to read it through!

Everything can be downloaded from official SDN website, as usual. If you are using Sitecore Instance Manager, please update it to latest version to support latest build (and rename it according to SIM naming convention -Sitecore 8.1 rev. 151003.zip. If not - it is now a good time to consider that handy software (read my article about it).

Also Sitecore xDB Cloud should get out of beta along with 8.1 release - there is now xDB Cloud Usage Policy available there.


So, briefly, what are new / fixed features?

  • SPEAK updated to 2.0 - now there's less SPEAK plumbing to go with it, more time to concentrate on business logic (link)
  • Sitecore 8 may now function as normal with xDB disabled - this is called CMS-only mode (link)
  • MVC Areas now work out-of-the-box (link)
  • Experience Editor improvements (both functional and performance)
  • Multiple xDB and Analytics improvements, new Path Analyzer
  • Contact Behavior Profile - enabled "dynamic" personalization based on previous contact activity (sort of artificial intellect)
  • Language Fallback now works out-of-the-box
  • xDB now fully support Mongo 3.0
  • Analytics got more missing UI
  • Sitecore subscription-based services
  • Device Detection (as subscription-based service) now identifies device types out of box bases on hundreds of params
  • Geo IP now is a subscription-based service
  • Sitecore now logs client-side javascript errors along with its own backend exceptions
  • CMS-only mode (link)
  • Shared / versioned layouts improvements
  • All associated modules updated as well (WFFM, ECM, etc.)

Breaking licensing change: Sitecore 8.1 now requires a license with the “Sitecore.xDB” key to enable all features of the Experience Platform. If your license file does not contain this key, Sitecore will default to Experience Management (CMS-only) mode. Any customers or partners with a license to Experience Platform should contact their account manager or login to SPN if they are missing this key.

Read more by official Release Notes link

StackOverflow: Can a multilingual Sitecore 6 web page have an alias for each language?

Question on StackOverflow - can a multilingual Sitecore 6 web page have an alias for each language? (link to original question)

Can a multilingual Sitecore 6 content page have an alias for each language? It appears that I can only add one per content page. For instance, labour_market_survey.html has an english page and a french page:

http://www.site.ca/en/labour_market_survey
http://www.site.ca/fr/labour_market_survey

But I can only give the content page one alias: http://www.site.ca/survey
How can I add a french alias, such as: http://www.site.ca/enquete ?
Answer: aliases are just sort of web-root-level "links" to certain items, mostly intended to use for marketing campaigns as short and friendly Tokens. To achieve what you want you may consider few options:
  1. If you have configured an individual website for each language - then you may create SiteAliasResolver processor for HttpBeginRequest pipeline. This will give you an option to have aliases on website level. Please reed this blog post describing how to achieve that (with code samples).

  2. Another option would be to use Redirect Module, as it will do exactly what you need. There was a question on Redirect Module recently, so there is exact example how to create a redirect item for any virtual URL that will do 301 to any specific sitecore item (which belong to some page item under corresponding language website): enter image description here

  3. If you are resolving languages on-a-fly so that the same item in Sitecore serves different languages (based on criteria how you resolve that), then you may use aliases as they are (but as I understood from your example that isn't your case)

P.S. Also, if you decide to go with aliases, mind Canonical URLs (link one and link two) as they may affect your SEO.

Hope someone finds that helpful!

Sitecore Improvements project

I have done multiple Sitecore presentation and productivity improvements, so this time I decided to unite them all under the same umbrella in GitHub, and this blog post will go through all of them.


1. Sitecore Style Adjustments

2. Device Editors Shortcuts

3. Layout Details Shortcuts

4. Presentation Exists Gutter

5. Publish Item Context Menu

6. Publish Item Ribbon Icon

7. Set Presentation Context Menu Icon


Packages can be downloaded below:

Sitecore 8.0 Style Adjustments-1.2.zip (29KB)
Sitecore 8.1 Style Adjustments-1.2.zip (28.9KB)
Device Editor Shortcuts 1.0.zip (8.6KB)
Layout Details Shortcuts 1.1.zip (10.8KB)
Presentation Exists Gutter 1.0.zip (12.7KB)
Publish Item Context Menu-1.0.zip (11.1KB)
Publish Item Ribbon Icon 1.0.zip (4.2KB)
Set Presentation Context Menu Item 1.0.zip (11.4KB)

Source code (and the docs / more packages) can be taken from project's GitHub page by the following link.

Hope you find this helpful!