<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">Blog posts by Nhat Luu</title><link href="http://world.optimizely.com" /><updated>2018-10-12T08:27:16.0000000Z</updated><id>https://world.optimizely.com/blogs/nhat-luu/</id> <generator uri="http://world.optimizely.com" version="2.0">Optimizely World</generator> <entry><title>Display all Opt-in processes in EPiServer Campaign Connector</title><link href="https://world.optimizely.com/blogs/nhat-luu/dates/2018/10/display-all-opt-in-processes-in-episerver-campaign-connector/" /><id>&lt;p&gt;By default, EPiServer Campaign Connector only displays opt-in processes of type &lt;strong&gt;Double&lt;/strong&gt;:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/c869bf89c83443f49d002aa0ce6c0424.aspx&quot; /&gt;&lt;/p&gt;
&lt;p&gt;However, sometimes we want to display opt-in processes of other types (&lt;strong&gt;Single&lt;/strong&gt;&lt;strong&gt;, Confirmed&lt;/strong&gt;). We can easily achieve this by overriding the default behaviour.&lt;/p&gt;
&lt;p&gt;Firstly, we need to create a class which inherits from the default OptinProcesseService, then override the&amp;nbsp;&lt;strong&gt;GetAllowedOptInProcesses&amp;nbsp;&lt;/strong&gt;method:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;public class CustomOptinProcessServive : OptinProcessService
{
    ...

    public override IEnumerable&amp;lt;SelectItem&amp;gt; GetAllowedOptInProcesses()
    {
        // GetAllOptInProcesses() returns a list of all opt-in processes where each item is a Tuple&amp;lt;long, string, string&amp;gt;:
        // + 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 =&amp;gt; new SelectItem() { Text = x.Item2, Value = x.Item1 });
    }

    ...
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then register the above class as the default implementation for&amp;nbsp;&lt;strong&gt;IOptinProcessService&lt;/strong&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;context.ConfigurationComplete += (o, e) =&amp;gt;
{
    context.Services.AddTransient&amp;lt;IOptinProcessService, CustomOptinProcessServive&amp;gt;();
};&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now the Opt-in process drop-down will display all opt-in processes:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/d0ed9912189e40c1b477bc883bab7f2c.aspx&quot; /&gt;&lt;/p&gt;</id><updated>2018-10-12T08:27:16.0000000Z</updated><summary type="html">Blog post</summary></entry></feed>