Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
How do I get the form name in a custom, Umbraco Forms email template?
My first thought was to use the GetField method of the FormsHtmlModel passed to the view, but I don't know what the key for form name would be. I've tried "formName" and "form_name" to no avail.
Did you work this out?
I did it myself by creating a hidden field with default value but there must be a more elegant solution.
I'm not using the Forms Email Templates until they add these features back in. It's like one step forward and two steps back with every new update.
Instead, I've started using the PerplexMail package, which provides a Forms Workflow out of the box. I had to tweak a file to get the recordID and form name in the email template, but the package is open source so this was relatively easy. Let me know if you need help.
did they get rid of it?
Sorry for the bump, did this ever get resolved? I'm also trying to add the form name to the email template the customer will receive but without any luck.
My last try was;
now I have a solution, that works for me:
var uHelper = new UmbracoHelper(UmbracoContext.Current);
Umbraco.Forms.Data.Storage.FormStorage formStorage = new Umbraco.Forms.Data.Storage.FormStorage();
var formId = new Guid(uHelper.AssignedContentItem.GetPropertyValue<string>("form"));
var form = formStorage.GetForm(formId);
UmbracoAssignedContentItem is the page where you have picket the Form. So I get the guid from the form. With this the form and the Name of the form.
I hope this helps you, too!
Thanks for the work-around, Jeremias.
Here's what I went with:
// Get form name
var formStorage = new Umbraco.Forms.Data.Storage.FormStorage();
var form = formStorage.GetForm(Model.FormId);
var formName = form.Name;
I'm trying to reuse a single template for multiple forms, and would like to get the form name into the email template. When I try your example code, I get the following error.
The type or namespace name 'FormStorage' does not exist in the namespace 'Umbraco.Forms.Data.Storage'``
How do we access the FormStorage in the latest Umbraco Forms version?
Did you ever find an answer to this Diedrik?
I'm trying to do exactly the same as you with a re-usable template but FormStorage appears to be an internal class now.
Is there an alternative way of getting the form name?
There is more information about how to get this info here:
If you need more information in the template you need to add a new feature request. there
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted