Nuno Linhares
Nuno Linhares

Reputation: 10234

How to get the WorkItem of an object in Workflow?

In Tridion 2011 SP1, Event System, I'm trying to get the WorkItem of an object that I know is in workflow, but I don't know in whose WorkList it might be.

Scenario Description:

What I thought of doing was an Event triggered on FinishActivityEventArgs, which would:

  1. Check if current item is Component
  2. Get the corresponding page (GetUsingItems of type page)
  3. Check if the page is also in workflow
  4. Get the page in question
  5. Get the WorkItem for the page
  6. Finish the current activity and pass on the corresponding activity details

I am about ready with most steps but having doubts on step 5. The only method I see so far to get the WorkItems is using session.WorkflowManager.GetUserWorkItems(userWorkItemsFilter) but this will probably fail if the page is not in the current user's work items, right?

Any tips/directions?

Upvotes: 4

Views: 370

Answers (1)

Chris Summers
Chris Summers

Reputation: 10163

I believe you will need to use the session.WorkflowManager.GetListProcesses method to find all the processes, rather than just the ones for the current user. I imagine you may need to impersonateate as an Administrator in order to get all the items back though.

Upvotes: 4

Related Questions