IEventHandler

Topics: Administration, Core, Customizing Orchard, General, Jobs, Writing modules, Writing themes
Aug 30, 2014 at 8:32 PM
Is there any new replacement for IEventHandler? Is it deprecated or i can use it?

Ex. I have a table in module #1. I want to send an email in module #2 when a new record added to this table in module #1. I need some data of new created record to use in email message.

There is no content item. Therefore i cannot use workflow activity. Is this correct?

What is the alternative way for this scenario?
Developer
Aug 31, 2014 at 4:40 AM
IEventHandler is not deprecated as far as I know - why are you looking for a replacement?
It is perfectly fine to execute a workflow without a content item - simply pass in null for the content item argument, and specify any other data you need via the tokens argument.
Aug 31, 2014 at 7:02 AM
@sfmskywalker, Thank you so much for quick reply. Probably i mistake because i thought that i read this somewhere.
I will try to create the new workflow activity but i don't know how can i manage that in code of module #2 when module #1 fires the activity.
I think the only way for using this activity is working with Workflow UI. Correct?
Aug 31, 2014 at 8:50 AM
And two more question:
Suppose i want to use timer in my workflow to send an email for new created record in the future (my custom activity -> timer -> send email).
  1. Since i have passed null as Content Item argument, Is there any way for persisting record's data for further sending?
  2. I there a way that i can create above workflow in code not in UI?