Skip to main content

Posts

Showing posts from 2016

Validating for uniqueness with EPiServer

This is just a short post describing a method found for validating that the value provided for field within a page or block is unique across other instances of that content type. The specific need was for a poll block that provided a question and set of answers for users to pick from, with the results being saved to the dynamic data store. I had an "identifier" field that the editors had to complete, the value of which being unique across all polls. And rather than relying on them to remember that, it's obviously better to validate it. Here was the solution. Firstly I created an extension method that gets a list of all blocks of a given type other than the current block, looking like this: public static IEnumerable<T> GetOtherContentData<T>(this T instance) where T : IContentData { var contentTypeRepository = ServiceLocator.Current.GetInstance<IContentTypeRepository>(); var contentModelUsage = ServiceLocator.Current.GetIn...

Redirect to HTTP behind load balancer (apart from localhost) with URL rewrite

Just a short "note to self for future" post as found a few variations for part of this online but needed to pull them together. Requirement is: Ensure all HTTP requests are redirected to HTTPS Handle the fact that the web server is behind a load balancer that terminates HTTPS Allow for local HTTP requests via a custom port

Personalisation and caching with Umbraco

A little while ago I put together a package for Umbraco called Personalisation Groups as a means of providing personalisation features to the Umbraco CMS. One addition I've been considering is how to add better support for use of caching for a web application utilising personalisation features. In any context, not just Umbraco, this isn't straightforward. Normally caching, at least on a page level, is going to be varied by the request URL. But of course with personalisation in place, for a given page, we are displaying different content to different users and so we don't want the cached version of a page customised to particular user being displayed to the next. There are a few ways to potentially tackle this. Some personalisation engines would look to do this client-side, using JavaScript to make the page modifications. Donut caching might be another approach if you are able to construct the templates to match it's requirements. I've looked though to tr...

Creating a Confirmation Email With EPiServer Forms

Had what probably seemed quite a straightforward request for an EPiServer site in development that's using EPiServer Forms - an add-on that allows editors to create their own forms to receive input from the site visitors and review the submissions in the back-office.  They wanted a confirmation email to go to the recipient. Of course though, we don't know what fields the editors are going to create. There may not be one for the visitor's email address. nd even if there were, how can we know which field is the one to use? I came up with a solution to this that requires some simple conventions for the editor to follow but is quite straightforward for them to set up. The first step was to create a new model for the form, inheriting from the base one provided but adding additional properties for the confirmation email details: public class FormContainerWithConfirmationEmailBlock : FormContainerBlock, IHasConfirmationEmail { [Display( Name =...

Personalisation Packages in Umbraco

Had the pleasure of giving a talk at the Umbraco Codegarden 2016 festival this week, along with Theo Paraskevopoulos of Growcreate . As mentioned at the time have collected here links to the slides and various resources mentioned during the session. Firstly the presentation itself can be viewed here . The Personalisation Groups package can be downloaded from our.umbraco.org here and the source code is up on Github . And you can read more about and download Pipeline CRM here .

Getting Started with MS Dynamics API

This is mostly a "note to self" post following some research and prototyping into working with the Microsoft Dynamics API from ASP.Net but might also be useful for anyone else that stumbles across it trying to get things working on this front. Accessing a Dynamics Instance First step for me was to get access to an instance of MS Dynamics to work with by signing up for a free trial . This gives access to a fully featured set up of Dynamics that you can work with for 30 days. You'll need to sign up with a user name and password and get assigned a sub-domain that will be of the form *.onmicrosoft.com. All of these will be needed for accessing via the API. Working with the API Starting with an empty ASP.Net MVC application, the first step is to install a NuGet package: PM> Install-Package Microsoft.CrmSdk.Extensions And then add references to the following assemblies: System.IdentityModel.dll System.Data.Services.dll System.Data.Services.Client.dll S...