<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><language>en</language><title>Blog posts by Nhat Luu</title> <link>https://world.optimizely.com/blogs/nhat-luu/</link><description></description><ttl>60</ttl><generator>Optimizely World</generator><item> <title>Display all Opt-in processes in EPiServer Campaign Connector</title>            <link>https://world.optimizely.com/blogs/nhat-luu/dates/2018/10/display-all-opt-in-processes-in-episerver-campaign-connector/</link>            <description>&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;</description>            <guid>https://world.optimizely.com/blogs/nhat-luu/dates/2018/10/display-all-opt-in-processes-in-episerver-campaign-connector/</guid>            <pubDate>Fri, 12 Oct 2018 08:27:16 GMT</pubDate>           <category>Blog post</category></item></channel>
</rss>