SaaS CMS has officially launched! Learn more now.

Nhat Luu
Oct 12, 2018
  3505
(3 votes)

Display all Opt-in processes in EPiServer Campaign Connector

By default, EPiServer Campaign Connector only displays opt-in processes of type Double

However, sometimes we want to display opt-in processes of other types (Single, Confirmed). We can easily achieve this by overriding the default behaviour.

Firstly, we need to create a class which inherits from the default OptinProcesseService, then override the GetAllowedOptInProcesses method:

public class CustomOptinProcessServive : OptinProcessService
{
    ...

    public override IEnumerable<SelectItem> GetAllowedOptInProcesses()
    {
        // GetAllOptInProcesses() returns a list of all opt-in processes where each item is a Tuple<long, string, string>:
        // + Item1 is the Id of the optin process
        // + Item2 is the Name of the optin process
        // + Item3 is the Type of the optin process
        return GetAllOptInProcesses().Select(x => new SelectItem() { Text = x.Item2, Value = x.Item1 });
    }

    ...
}

Then register the above class as the default implementation for IOptinProcessService:

context.ConfigurationComplete += (o, e) =>
{
    context.Services.AddTransient<IOptinProcessService, CustomOptinProcessServive>();
};

Now the Opt-in process drop-down will display all opt-in processes:

Oct 12, 2018

Comments

Please login to comment.
Latest blogs
A day in the life of an Optimizely Developer - London Meetup 2024

Hello and welcome to another instalment of A Day In The Life Of An Optimizely Developer. Last night (11th July 2024) I was excited to have attended...

Graham Carr | Jul 16, 2024

Creating Custom Actors for Optimizely Forms

Optimizely Forms is a powerful tool for creating web forms for various purposes such as registrations, job applications, surveys, etc. By default,...

Nahid | Jul 16, 2024

Optimizely SaaS CMS Concepts and Terminologies

Whether you're a new user of Optimizely CMS or a veteran who have been through the evolution of it, the SaaS CMS is bringing some new concepts and...

Patrick Lam | Jul 15, 2024

How to have a link plugin with extra link id attribute in TinyMce

Introduce Optimizely CMS Editing is using TinyMce for editing rich-text content. We need to use this control a lot in CMS site for kind of WYSWYG...

Binh Nguyen Thi | Jul 13, 2024

Create your first demo site with Optimizely SaaS/Visual Builder

Hello everyone, We are very excited about the launch of our SaaS CMS and the new Visual Builder that comes with it. Since it is the first time you'...

Patrick Lam | Jul 11, 2024

Integrate a CMP workflow step with CMS

As you might know Optimizely has an integration where you can create and edit pages in the CMS directly from the CMP. One of the benefits of this i...

Marcus Hoffmann | Jul 10, 2024