I am trying to create a custom workflow within Umbraco forms to allow users to sign up for a mailing list in Newsletter Studio.
The form works and the workflow runs but no information is copied into the mailing list, what am I missing?
using Umbraco.Forms.Core;
using Umbraco.Forms.Core.Enums;
using Umbraco.Forms.Core.Persistence.Dtos;
using NewsletterStudio.Core.Public.Models;
namespace MyFormsExtensions
{
public class Subscribe : WorkflowType
{
public Subscribe()
{
Name = "Newsletter Sign-up";
Id = new Guid("7793f98d-266f-4905-b2f2-9d27438da763");
Description = "Add sign-ups to the mailing list";
Icon = "icon-inbox";
}
public override WorkflowExecutionStatus Execute(WorkflowExecutionContext context)
{
RecordField? recordNewsletteremail = context.Record.GetRecordFieldByAlias("email");
RecordField? recordName = context.Record.GetRecordFieldByAlias("name");
RecordField? recordDistrict = context.Record.GetRecordFieldByAlias("district");
var newsletteremail = recordNewsletteremail.ValuesAsString();
var name = recordName.ValuesAsString();
var district = recordDistrict.ValuesAsString();
var request = AddRecipientRequest.Create(newsletteremail)
.WithSource("Footer")
.WithName(name)
.WithCustomField("District", district)
.SubscribeTo(Guid.Parse("15C21B14-2673-40E1-9730-ED04B4161DE4"))
.Build();
return WorkflowExecutionStatus.Completed;
}
public override List<Exception> ValidateSettings()
{
return new List<Exception>();
}
}
}
thanks, I've tried it both with and without the workspace key, in the documentation it says if you don't include one it will use the default workspace which is the only one I have.
Linking Umbraco Forms with Newsletter Studio
I am trying to create a custom workflow within Umbraco forms to allow users to sign up for a mailing list in Newsletter Studio.
The form works and the workflow runs but no information is copied into the mailing list, what am I missing?
I'm taking a guess, I have a workspaceKey in my code. Add to request something like .ForWorkspace(yourKey)
thanks, I've tried it both with and without the workspace key, in the documentation it says if you don't include one it will use the default workspace which is the only one I have.
is working on a reply...