This is a built-in Umbraco workflow, it might only work with Umbraco's File Upload. Unfortunately, Umbraco Forms is not open source so I cannot look at their source. As far as I can tell there is no way for us to specify whether our Field Type (like File Upload / Image Upload) generates attachments so it can be picked up by the workflow. The workflow might just match on field type alias and/or unique field type id and is not checking for our field types.
Perhaps you can ask Umbraco if their workflow works with custom field types.
Thanks for the quick response. Makes sense, it does work when using the non-html workflow as well, so hopefully this wouldn't be a big change to Umbraco Forms if they could implement it.
For anyone that runs into this issue, there is a workaround for this problem. It requires a custom workflow unfortunately, but it fairly straightforward and can be seen below (this implementation is for umbraco 8).
public class CustomSendRazorEmail : SendRazorEmail {
public CustomSendRazorEmail (IHttpContextAccessor httpContextAccessor, IFieldTypeStorage fieldTypeStorage, IFormStorage formStorage, IUmbracoContextAccessor umbracoContextAccessor, IPageService pageService, IWorkflowEmailService workflowEmailService) : base(httpContextAccessor, fieldTypeStorage, formStorage, umbracoContextAccessor, pageService, workflowEmailService) {
Id = new Guid("{unique id}");
Name = "Custom Send Razor Email";
Icon = "icon-message";
Group = "Services";
}
public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e) {
var uploadFieldId = new Guid("{id of custom upload field}");
var uploadFields = record.RecordFields.Where(x => x.Value.Field.FieldTypeId == uploadFieldId);
//this is a hack to get umbraco forms to attach files from a custom upload field
foreach (var uploadField in uploadFields) {
uploadField.Value.Field.FieldTypeId = new Guid(Constants.FieldTypes.Upload);
}
var result = base.Execute(record, e);
foreach (var uploadField in uploadFields) {
uploadField.Value.Field.FieldTypeId = uploadFieldId;
}
return result;
}
}
Umbraco forms only attaches files from the built in upload field, so the hack involves assigning that id to the custom upload fields. This will get the base class to attach those files when it's executed. It then reverts those id changes to avoid causing problems in future workflows. This is definitely a hack, but it will work until we get a proper fix for this problem (issue filed in bug tracker here).
Upload files not being attached when choosing the Send Email with Template (Razor) workflow
I am using the following versions: Umbraco 7.10.2 Umbraco Forms 7.0.1 Perplex Forms 1.8.3
I did a clean install of all three, and am using the Perplex File Upload to select files, on a simple form.
Then I create a workflow item - selecting to attach uploaded files - Send Email with Template (Razor).
The email sends but the attachment isn't added, when I switch to using the native File Upload then it works.
I have the smtp server on my local machine so I can see it's not being attached.
Any ideas how I can fix this?
Thanks in advance.
Hi Matt,
This is a built-in Umbraco workflow, it might only work with Umbraco's File Upload. Unfortunately, Umbraco Forms is not open source so I cannot look at their source. As far as I can tell there is no way for us to specify whether our Field Type (like File Upload / Image Upload) generates attachments so it can be picked up by the workflow. The workflow might just match on field type alias and/or unique field type id and is not checking for our field types.
Perhaps you can ask Umbraco if their workflow works with custom field types.
-- Daniël
Hey Daniel,
Thanks for the quick response. Makes sense, it does work when using the non-html workflow as well, so hopefully this wouldn't be a big change to Umbraco Forms if they could implement it.
Thanks,
-M
For anyone that runs into this issue, there is a workaround for this problem. It requires a custom workflow unfortunately, but it fairly straightforward and can be seen below (this implementation is for umbraco 8).
Umbraco forms only attaches files from the built in upload field, so the hack involves assigning that id to the custom upload fields. This will get the base class to attach those files when it's executed. It then reverts those id changes to avoid causing problems in future workflows. This is definitely a hack, but it will work until we get a proper fix for this problem (issue filed in bug tracker here).
is working on a reply...