November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hi ChiChing,
Yes you can achieve that by creating a new class implementing IPlaceHolderProvider interface. A new place holder named SYSTEMCOLUMN_HostedPage will be shown when you are inserting place holder into email template.
And here is the code. I tested and it works fine.
using EPiServer.Core;
using EPiServer.Forms.Core.Internal;
using EPiServer.Forms.Core.Models;
using EPiServer.Forms.Helpers.Internal;
using System.Collections.Generic;
using System.Web;
namespace Forms_Verify_Hidden.Customization
{
public class CustomPlaceHolderProvider : IPlaceHolderProvider
{
/// <summary>
// PageLink (or content link) of the page hosts the FormContainerBlock
/// </summary>
private const string _submittedFrom = EPiServer.Forms.Constants.SYSTEMCOLUMN_HostedPage;
/// <summary>
/// DefaultPlaceHolderProvider has order is 1000. Providers will be run in ascending order
/// </summary>
public int Order
{
get { return 1; }
set { }
}
public IEnumerable<PlaceHolder> ExtraPlaceHolders
{
get
{
// add new place holder: Submitted from page with empty value just to show in place holder dropdown in email template
return new PlaceHolder[] { new PlaceHolder (_submittedFrom, "") };
}
}
public IEnumerable<PlaceHolder> ProcessPlaceHolders(IEnumerable<PlaceHolder> availablePlaceHolders, FormIdentity formIden, HttpRequestBase requestBase = null, Submission submissionData = null, bool performHtmlEncode = true)
{
foreach (var ph in availablePlaceHolders)
{
if (ph.Key == _submittedFrom)
{
// here we update the value of hosted page
var fromPageId = submissionData.Data[_submittedFrom] as string;
ContentReference pageContentLink;
if (ContentReference.TryParse(fromPageId, out pageContentLink))
{
ph.Value = pageContentLink.GetContent()?.Name;
}
}
}
return availablePlaceHolders;
}
}
}
Hi,
In formsubmission has a coloum "Submitted From", shows which page the user submitted the form from.
I am wondering is it possible to add this information in the mail (Send mail after submission)?
Thanks,
ChiChing