This project is read-only.

Send email to various email addresses based on option selected in the form submitted

Topics: Customizing Orchard
Sep 8, 2014 at 6:12 PM
Edited Sep 8, 2014 at 8:25 PM
I built a custom (contact us) form that contains a dropdown list with several options I need to create a workflow that sends an email to a specific address based on which item in the dropdown list was selected, but I've no idea how to go about doing this as the workflows in orchard only allow for sending an email when the form is submitted and not based on any of the content that was in the form. Is this possible? Will I need to create a custom workflow activity that somehow searches the contents of the form for user specified text and then send an email if the text is found in the form?

Edit: I noticed when using the email workflow activity it has access to the dropdown list in my contact us form through the use of Tokens. Is there a way I can access these tokens in custom workflow activity in a custom module so I can create a workflow activity that looks at that specific token's value and continues the workflow if it is equal to whatever the user enters in a text field that the value should equal?
Sep 8, 2014 at 10:17 PM
You can implement a custom activity that accesses the current content item in any way you want. The best thing to do is probably also implement a form using the forms API as is done with the Email activity, where the various fields are tokenized. You would then use the evaluated tokenized field values from within your custom activity. Take a look at the Email activity source code to see how this is done.
Marked as answer by emeraldarcher on 9/9/2014 at 8:14 AM
Sep 9, 2014 at 6:31 PM
Thanks sfmskywalker I was able to get it working by looking at the Email Activity.