Personalisation is the essence of email marketing.  Making your messages relevant to your audience increases engagement and conversion rates.  In Dynamics 365 Marketing it’s easy to add ‘simple’ personalisation into an email – for example to personalise the subject line with the contact’s name.

But what about more complex personalisation – such as rotating which image or messaging is presented according to the contact’s occupation? You could – if you wanted to, create multiple versions of your email, each with the appropriate content for the audience.  Or, you could use a Custom Code block.

Custom code blocks are an OOTB design element in Dynamics365 Marketing.  Simple drop the Custom code tile onto the design canvas and you’ll add a Custom Code content block.

Now for the (only) tricky bit – you need someone with a knowledge of Java coding to write you a short script.  The example we’re using here is to rotate an image based on the contact’s last name (but it could be any field on the contact record).  This code took one of our Developers just a few minutes to write and test.

Now, it’s just a simple cut & paste of this code into the Custom Code properties box.

Create the rest of your email, ‘Check For Errors’, and assuming all is OK, do test sends to confirm the variants are working – making sure that one of your Test Contacts meets the condition (in our case, Lastname = Bastow), and that one doesn’t.

Check your email account for the test sends, and voila – the appropriate image appears, automagically.  On my test emails there was a very short pause in email rendering for communication back to the server, but nothing really noticeable.

This is a pretty simple example to show the principle.  For another example (and with thanks for the inspiration), check out this post by Vincent Groenheijde on the Dynamics 365 Marketing Community Blog (here) on personalising an event confirmation with the relevant sessions that a contact has signed-up for.

Barhead Solutions Marketing Practice

Barhead a specialised consulting firm focused on delivering business solutions, leveraging Microsoft’s  Technology Stack We believe that it is a combination of people, technology, and business drivers that underpin the most successful implementations.

The Marketing Solutions team at Barhead are a dedicated and specialised group, focussing on helping our clients deliver value from marketing technology.  Our services span:

  • Select & buy.  We can help you find the most appropriate solution to your marketing requirements, across the Microsoft , Adobe and ISV portfolios;
  • Implement, configure, integrate, extend.  Systems integration is Barhead’s central competency – we have support full end-to-end implementations for many clients;
  • Value realisation & customer success.  Great marketing solutions start with great implementations, but need ongoing attention, support and guidance.  We can provide ongoing advisory, upskilling & guidance to ensure our clients continue to realise full benefits from their solutions;
  • Support.  We can provide cost-effective operational support and managed services.  From staff augmentation to full managed services, we can help.

Dynamics 365 For Marketing

Dynamics 365 For Marketing is a richly-featured marketing automation application from Microsoft, natively integrated with Dynamics 365 Customer Engagement.  Introduced in May 2019, it has already a strong worldwide user base and gains all the benefits of being an embedded part of the Microsoft Power Platform.

Core features & functionality include:

  • Digital marketing.  Journeys, segmentation, automation, forms, landing pages, website tracking – all available and easily configurable without reliance on IT or agencies
  • Advanced segmentation & marketing lists.  Create sophisticated segments and audiences for your campaign, seamlessly combining profile and interaction attributes
  • Fully-featured events management platform.  Run a conference, or a party, with full tracking of attendees
  • Surveys.  Embedded survey functionality, with responses written directly back you the CRM means no need for a separate survey tool.
  • Turn-key application.  Installed onto your existing D365 CE application(s), Dynamics 365 For Marketing works, out-of-the-box
  • Highly configurable & extensible.  Extend and enhance with Flow, PowerBI and PowerApps.  Add connectors and integrations from the Microsoft AppSource.  The options and opportunities are endless

Richard Britton

Richard leads marketing solutions team at Barhead.  As a 20-year veteran in the marketing automation industry, Richard has led and/or supported many marketing technology projects.  With a career that spans consultancy and client-side, Richard has a deep wealth of experience and expertise in all aspects of technology-based marketing.

Richard can be contacted at  Alternatively you’ll find Richard on LinkedIn at or on Twitter at @richardbritton