We have some form templates, and would like each form created from these templates to share the same workflow setup. Right now, we can easily create copies of the form, but must manually go in and recreate all of the workflows afterwards. Is there any way to get workflows into a template, or should I start hacking up the form creation code?
We'll add this to the todo list but won' be for a couple of weeks untill we can add this...
By hooking into the form event model you should be able to add a workflow
The event you need to use is:
FormStorage.FormCreated
Here is an example (is used to attached the email workflow on form creation)
public static void AttachEmailWorkflow(Form f)
{
WorkflowStorage workflowStorage = new WorkflowStorage();
//setup a standard workflow to send off emails when the form is submitted
string email = ProviderManager.Instance.UmbracoContextProvider.GetCurrentUserEmail();
if (!string.IsNullOrEmpty(email))
{
Workflow wf = Workflow.Create();
wf.ExecutesOn = Umbraco.Forms.Core.Enums.FormState.Submitted;
wf.Name = "Send email to " + email + " when submitted";
wf.Form = f.Id;
wf.Active = true;
wf.Type = Umbraco.Forms.Core.Providers.WorkflowTypeProviderCollection.Instance.GetProvider(new Guid("E96BADD7-05BE-4978-B8D9-B3D733DE70A5"));
Dictionary<string, string> wfSettings = new Dictionary<string, string>();
wfSettings.Add("Email", email);
wfSettings.Add("Subject", "the form " + f.Name + " was submitted");
wfSettings.Add("Message", "the form " + f.Name + " was submitted, this is the list of values it contained, you can turn this email off under workflows in Umbraco Contour");
wf.Settings = wfSettings;
workflowStorage.InsertWorkflow(wf);
}
}
Hi, Tim. That would be great if it could be added as a feature. Has it been added to the todo list? If so, do you have an ETA? I will attempt to do it myself, but would rather not duplicate your efforts if you plan on completing it soon.
Workflow templates?
We have some form templates, and would like each form created from these templates to share the same workflow setup. Right now, we can easily create copies of the form, but must manually go in and recreate all of the workflows afterwards. Is there any way to get workflows into a template, or should I start hacking up the form creation code?
Comment author was deleted
Hey,
We'll add this to the todo list but won' be for a couple of weeks untill we can add this...
By hooking into the form event model you should be able to add a workflow
The event you need to use is:
FormStorage.FormCreated
Here is an example (is used to attached the email workflow on form creation)
Hi, Tim. That would be great if it could be added as a feature. Has it been added to the todo list? If so, do you have an ETA? I will attempt to do it myself, but would rather not duplicate your efforts if you plan on completing it soon.
Thanks.
Comment author was deleted
Well main focus is on the v5 version currently, wich is due in the next weeks, to add this an ETA would be first half of May
is working on a reply...