Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • jake williamson 207 posts 872 karma points
    Sep 10, 2019 @ 01:35
    jake williamson
    0

    hooking into an existing umbraco forms workflow from a custom workflow?

    hey out there,

    i've written a custom workflow that's 99.9% the same as the Send email workflow that ships with umbraco forms.

    what i'm trying to work out is if i can create an instance of the Send email workflow and pass my workflow properties to it?

    seems crazy to duplicate the code!

    i guess what i need is something like:

    var sendEmailWorkflow = new SendEmailWorkflow();
    sendEmailWorkflow.Email = myWorkflow.Email;
    sendEmailWorkflow.SenderEmail = myWorkflow.SenderEmail;
    ect.
    

    is this possible? i'm digging around in the Umbraco.Forms.Core and Umbraco.Forms.Web dlls but i'm not finding anything yet...

  • jake williamson 207 posts 872 karma points
    Sep 10, 2019 @ 04:40
    jake williamson
    101

    well, i dug out a copy of dotpeak and started digging through the dlls...

    and hey presto, i got something working ;)

    this is the stripped down code:

    var sendEmailWorkflow = new Umbraco.Forms.Core.Providers.WorkflowTypes.SendEmail(_xmlService, _contentSection)
    {
        Email = email,
        SenderEmail = SenderEmail,
        Subject = Subject,
        Message = Message,
        Attachment = Attachment
    };
    sendEmailWorkflow.Execute(record, e);
    

    i'm injecting the IXmlService and IContentSection into the constructor of my custom workflow.

    the email property is the only difference in my custom workflow as i'm setting it based on a value in the form.

    so far the above is working a treat. nice.

    hope this helps someone out there.

Please Sign in or register to post replies

Write your reply to:

Draft