5

We are currently writing a number of Outbound Email templates. As all other templates are using the Razor Mediator, we are also using this for our templates for Outbound Email.

One of the issues we stumbled upon is how to use the specific DWT functions such as GetLinkTrackingURL() or SetEmailType(). These can easily be called from within a Dreamweaver template, but they are not available by default when you use the Razor Mediator.

We found an interesting post here : IFunctionSource functions for DWT in Razor?.

I added the functionsource assembly to the tag in my config, and added the code as specified in the response from Alex.

Unfortunately, this answer was for Tridion 2011, while i'm using Tridion 2013 SP1. When I tried to save the Razor TBB, I got the following error:

TemplateCompileException: CS1729: 'Tridion.OutboundEmail.Templating.OutboundEmailFunctionSource' does not contain a constructor that takes 0 arguments Line 26 Column 25: } public override void Execute() { * var OutboundEmail = new Tridion.OutboundEmail.Templating.OutboundEmailFunctionSource(); OutboundEmail .Initialize(TridionHelper.Engine, TridionHelper.Package);

So it looks like something changed in Tridion 2013 so this fix no longer works.

5

I think you're right Harald, for 2013 it appears as though you don't need to call the "Initalize" method but can instead pass TridionHelper.Engine and TridionHelper.Package to the "OutboundEmailFunctionSource" constructor. Try this method:

@{
    var OutboundEmail = new Tridion.OutboundEmail.Templating.OutboundEmailFunctionSource(TridionHelper.Engine, TridionHelper.Package);

}

You can then use the OutboundEmail object to make your method calls, for example:

@{
    var OutboundEmail = new Tridion.OutboundEmail.Templating.OutboundEmailFunctionSource(TridionHelper.Engine, TridionHelper.Package);
    OutboundEmail.SetEmailType("text");
}
  • 1
    Just tried this, and it looks like this is working in Tridion 2013 indeed. – Harald Hoffelinck Jul 14 '15 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.