Define a Custom Token

Topics: Customizing Orchard
May 6, 2015 at 7:33 AM
Edited May 6, 2015 at 7:37 AM
I would like to define my own token to use within the workflow to send an email.

I create a dictionary object and add my token but cannot access it on the workflow form even though I can see it in the context when debugging. I already use the "Content" token but that model is used to build the email body using Orchard.Templates module so don't really want to add the below info to that model.

var tokens = new Dictionary<string, object>();

tokens.Add("Content", myModel);
tokens.Add("EmailAdresses", emailAddresses);
tokens.Add("Subject", subject);

_workflowManager.TriggerEvent("MyCustomEvent", null, () => tokens);