I am trying to get the performer of the previous activity in Tridion workflow using the Core Service. I cannot figure out how to get the ActivityData of the previous activity from the ActivityDefinition. I feel like I might be going about this in the wrong way. Here is my current code and I cannot get the prevActivityData.Performers

var wfItem = client.Read(uri, new ReadOptions()) as ComponentData;
var activityURI = wfItem.WorkflowInfo.ActivityInstance.IdRef;

ActivityInstanceData currentactivity = (ActivityInstanceData)client.Read(activityURI, new ReadOptions());
TridionActivityDefinitionData activitydefinition = (TridionActivityDefinitionData)client.Read(currentactivity.ActivityDefinition.IdRef, new ReadOptions());

ProcessDefinitionData processdefinition = (ProcessDefinitionData)client.Read(activitydefinition.ProcessDefinition.IdRef, new ReadOptions());
List<ActivityDefinitionData> activities = new List<ActivityDefinitionData>(processdefinition.ActivityDefinitions);
int i = 0;

foreach (ActivityDefinitionData activity in activities)
    if (activity.Title == prevActivityTitle)
        // prev activity
        var prevActivity = activities[i - 1];
        TridionActivityDefinitionData prevActivityDefData = (TridionActivityDefinitionData)client.Read(prevActivity.Id, new ReadOptions());

        // How to get ActivityData?
       // ActivityData prevActivityData = (ActivityData)client.Read(prevActivity.Id, new ReadOptions());

        LinkToUserData[] performers = prevActivityData.Performers;
        if (performers.Length > 0)
            return performers[0].IdRef;



2 Answers 2


This source code will give you the last Manual Activity Performer. I think it makes sense since the performer for the Automatic Activities is always the Workflow Agent Identity. This sample is for Tridion 2013. However you can easily adapt it to Tridion 2011 if needed.

public UserData GetLastManualActivityPerformer() {
    ActivityInstanceData lastManualActivity = GetLastManualActivity();
    return (UserData)CoreServiceClient.Read(lastManualActivity.Performers.Last().IdRef, ReadOptions);

public ActivityInstanceData GetLastManualActivity() {
    IEnumerable<ActivityInstanceData> activityInstances =
        ProcessInstance.Activities.OfType<ActivityInstanceData>().OrderByDescending(o => o.StartDate);

    return activityInstances.First(a => {
        TridionActivityDefinitionData activityDefinition =
            (TridionActivityDefinitionData)CoreServiceClient.Read(a.ActivityDefinition.IdRef, ReadOptions);
        return string.IsNullOrEmpty(activityDefinition.Script);

2011 solution:

var wfItem = client.Read(uri, new ReadOptions()) as ComponentData;
var processInstance = (ProcessInstanceData)client.Read(wfItem.WorkflowInfo.ProcessInstance.IdRef, new ReadOptions());
ActivityData[] activityInstances = processInstance.Activities;
LinkToUserData[] performers = activityInstances[0].Performers;
string performerUri = performers[0].IdRef;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.