Reputation: 2415
I'm using the new form feature in umbraco 7.2 and have a few forms set up, all working. I can see the enteries in the back office.
What I now want to do is set up a work flow that sends an email when the form is submitted, but I want to send the content of the form in the email, but I don't want to send everything thats is in the email only some of the fields.
Any ideas of how to do this?
Upvotes: 2
Views: 5955
Reputation: 4257
The workflows in the new forms work exactly the same as the ones in the older version apparently. You can create your own custom workflow using something like this:
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using System.Web;
using System.Xml;
using Umbraco.Forms.Core;
using Umbraco.Forms.Core.Attributes;
using Umbraco.Forms.Core.Enums;
using Umbraco.Forms.Data.Storage;
namespace WebApp.Contour
{
public class SendEmailToUser : WorkflowType
{
// Generates the new workflow details for Contour in the workflow dropdown in Contour
public SendEmailToUser()
{
// Need to generate a new guid for the new custom workflow - add your own GUID
this.Id = new Guid("PLACE GUID HERE");
this.Name = "PUT WORKFLOW NAME HERE";
this.Description = "PUT WORKFLOW DESCRIPTION HERE";
}
public override List<Exception> ValidateSettings()
{
List<Exception> exceptions = new List<Exception>();
//if you have any settings, validate them here
return exceptions;
}
public override Umbraco.Forms.Core.Enums.WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
{
//place your workflow execution logic here, "record" gives you access to the fields on the submitted record
return WorkflowExecutionStatus.Completed;
}
}
For more details on how to code workflows, have a look at the examples in this tutorial: creating a quiz in Contour
Upvotes: 1