Thursday, July 27, 2017

Sitecore WFFM custom save action not firing

After writing a custom WFFM save action and it testing okay on my local machine it was pushed up to a scaled UAT environment. The form was submitting as expected, however the custom save action was not firing.

This was verified by custom logging in the save action not hitting.

After some investigation I noticed that the Client Action had not been checked on the save actions definition. This meant that the action would not fire on content delivery instances in a scaled Sitecore environment.

Sitecore WFFM save action's client action option

Wednesday, July 19, 2017

Sitecore WFFM save action UI dialog is appearing empty

When creating a Sheer UI dialog for a custom save action in WFFM, it comes up empty like so:

Sitecore WFFM empty save action dialog
It's not mentioned easily in the available examples online, but the location of the XML file for the dialog can cause this error. Inside the Sitecore.config is the following section:
 <source mode="on" namespace="Sitecore.Web.UI.XmlControls" folder="/sitecore/shell/override" deep="true" />
 <source mode="on" namespace="Sitecore.Web.UI.XmlControls" folder="/layouts" deep="false" />
 <source mode="on" namespace="Sitecore.Web.UI.XmlControls" folder="/sitecore/shell/controls" deep="true" />
 <source mode="on" namespace="Sitecore.Web.UI.XmlControls" folder="/sitecore/shell/applications" deep="true" />
 <source mode="on" namespace="Sitecore.Web.UI.XmlControls" folder="/sitecore modules" deep="true" />
 <source mode="on" namespace="Sitecore.Web.UI.HtmlControls" assembly="Sitecore.Kernel" />
 <source mode="on" namespace="Sitecore.Web.UI.WebControls" assembly="Sitecore.Kernel" />
 <source mode="on" namespace="Sitecore.Shell.Web.UI.WebControls" assembly="Sitecore.Kernel" prefix="shell" />
 <source mode="on" namespace="Sitecore.Shell.Applications.ContentEditor" assembly="Sitecore.Kernel" prefix="content" />
 <source mode="on" namespace="Sitecore.Shell.Web.Applications.ContentEditor" assembly="Sitecore.Kernel" prefix="shell" />
 <source mode="on" namespace="Sitecore.WebControls" assembly="Sitecore.Kernel" />
 <source mode="on" namespace="System.Web.UI.WebControls" assembly="System.Web" prefix="asp" />
 <source mode="on" namespace="System.Web.UI.HtmlControls" assembly="System.Web" prefix="html" />
 <source mode="on" namespace="Sitecore.Web.UI.Portal" assembly="Sitecore.Kernel" />
 <source mode="on" namespace="ComponentArt.Web.UI" assembly="ComponentArt.Web.UI" prefix="ca" />
You could add your own source location in here, or place your XML file under and existing XML location (such as /sitecore/shell/applications).

Friday, July 14, 2017

IntelliSense error on Sitecore webforms sublayouts

Inside all sublayouts of an existing Sitecore visual studio solution the IntelliSense was not working and the control definition was underlines in blue with the following message:
ASP.NET runtime error: Could not load file or assembly 'System.Web.Http, Version, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of it's dependencies. The system cannot find the file specified.
The DLL was references in the web.config file, but not as a direct reference in the solution. It turned out the the System.Web.Http (and related DLLs) were missing in the bin project of the solution. Copying them over from a working version of the solution to the affected machine fixed the error.

Team Development for Sitecore code generation metadata file not found

In a visual studio solution using Team Development for Sitecore and code generated models, on the project build or manual re-generation the following error was occurring:
ERROR : on line 0 column 0 of file C:\Dev\MyProject\TDS.Master\Code Generation Templates\
Compiling transformation: Metadata file 'HedgehogDevelopment.CodeGeneration.Extensions.dll' could not be found
The first step is to ensure that the solution has been opened in administrator mode. If this does not solve the issue then it is likely that the HedgehogDevelopment.CodeGeneration.Extensions.dll DLL is not available to the process.

For visual studio 2015 the DLL needs to be placed in the following folder:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
In visual studio 2012 the DLL needs to be placed in the following folder:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies
The code generation should now work as expected.

Tuesday, July 4, 2017

Fiddler capturing service calls in .NET

Debugging what the raw request/response given for a given service call in your .NET website can save a lot of hassle getting to the bottom of an issue. Take this example, where the service was expecting empty string but instead was getting null - fiddler capturing that .NET service call solved the issue.

By default any service calls coming from your .NET website will not be captured by fiddler, the following proxy item needs to be added to the web site for the calls to be picked up.
    <proxy  proxyaddress="" />      
Remember to comment this out when fiddler is not running, otherwise the service calls will fail. To ensure secure service calls are logged and can be viewed, the following settings need to be enabled and a certificate for fiddler added to the local machine.

Telerik fiddler, capture and decrypt HTTPS secure traffic

Sitecore Commerce Server search criteria Model is not valid

When updating a user's profile on Sitecore commerce server (general details and a multi-valued address field), the following error occurred when the update operation executed.
The operation service has encountered an error while processing the request.  The error details have been logged by the service.Microsoft.Commerce.SequenceComponents.Exceptions.InvalidOperationRequestException: The operation could not be performed because the search criteria Model is not valid.  The search criteria Model must contain exactly one property that maps to a Commerce Server profile property defined as a primary, join, or unique key.
The update model is shown below:
Sitecore Commerce Server update model
The problem came down to an automapper error, where the two related update operations (related to the addresses object) did not have a valid ID added for existing addresses. So effectively an update operation was passed through without the ID of the address relationship being updated.