views:

123

answers:

4

I skimmed through the documentation but couldn't find an event handler to intercept activity creation in a workflow instance. I want to be notified whenever a new activity is created / entered.

Thanks.

A: 

Yes a tracking service will tell you when an activity started executing and when it is done. The ActivityStateRecord is what you want to be looking at.

Maurice
How can I run code "before" the activity executes? ActivityStateRecord works like a kind of logging mechanism, after the activity executes...
yang
Without adding it to the workflow? I don't think you can replace the scheduler and inject some custom code just before every activity executes.
Maurice
A: 

I don't believe that this is specifically supported, but I'm trying to find some options for you.

Can you provide a little more about your scenario and what type of work you want to do before each activity executes?

I'm asking if you can speak a little more about the dependencies that you are injecting. What is the business scenario that you are trying to accomplish?

Can you clarify why the following options are not sufficient? * Rewrite the workflow to inject your custom activities prior to execution * Embed the logic in your custom activities

kreinsch
A: 

I can't add comments to your post as I deleted the cookies and SO now sees me as a different user.

Here is the scenario:

I am trying to inject some dependencies into my custom activities. I have to do this before the activity executes because the code in Execute override depends on the values that I am trying to inject. So I have to run my code either at the same time the activity is created or before it is executed.

yang
A: 

I am looking for a way to add custom code before an activity in the workflow is executed. More specifically, I want to be notified when a new activity will be executed, check with some business rules and potentially modify the workflow itself (add a new activity, skip the next one etc.). Is it at all possible to do this? I need to do this for an arbitrary workflow, that is, I don't know what I will be working with in advance and I don't know what kind of acivities I will need to intercept, so I am interested in being notified of any activity taking place.

I would be really grateful if someone could give me an idea if what I want can be accomplished...

Thanks

Raya