I've created a workflow that's invoked when a user fills out and submits a "Contact Us" form. The workflow starts with an HTTP Request event, then eventually sends the email with an Email Task. But I want to skip over the Email Task if the sender's email address is from a certain domain. So after the HTTP Request event, I'm setting a workflow property called "SenderEmail" using a "Set Property Task" (set to httpContext().Request.Form.Email), and then I'm trying to access that property in either an "If/Else Task" or "Script Task" to check the sender's domain, but I can't seem to get that property value in either of those tasks. I know that the workflow property is set because I added a Log Task that logs {{Workflow.Properties["SenderEmail"]}}, and it does indeed log the sender's email address.
The If/Else Task is apparently a javascript expression that evaluates to True or False, and according to the Orchard Core documentation, this should work:
property("SenderEmail") == "some address"
I also tried the Script Task (it's C# code?), using several variations of syntax, something like this:
//var emailAddress = "{{Workflow.Properties['SenderEmail']}}";
//var emailAddress = {{Workflow.Properties["SenderEmail"]}};
//var emailAddress = "#{Workflow.Properties['SenderEmail']}";
//var emailAddress = property("SenderEmail");
//var emailAddress = workflow().property("SenderEmail");
//var emailAddress = workflow().Properties["SenderEmail"];
if (emailAddress.EndsWith("somedomain.com"))
{
setOutcome('Spam');
}
else
{
setOutcome('Real');
}
I would greatly appreciate any suggestions on how I can get this to work, or help me out with the proper syntax in the If/Else or Script Tasks. Below is a link to a pic of my workflow, and what I'm trying to accomplish...