3

I am debugging some workflow code. I have found the following code is throwing the exception 'activity Instance(tcm:10-2988-131104) does not exist.'

private ActivityInstance FinishActity(ActivityInstance instance, string message,
                                      Trustee nextAssignee, Session userSession)
{
  try
  {
    ActivityFinish finishActivity = new ActivityFinish(message, nextAssignee, userSession);
    return instance.Finish(finishActivity);
  }
  catch (PermissionDeniedException)
  {
    return null;
  }
  catch (InvalidActionException)
  {
    return null;
  }
}

It seems like the activity instance no longer exists when execution reaches the statement return instance.Finish(finishActivity)

Is there an activity instance timeout that might be the cause of this?

If so, where would I configure that timeout?

Sometimes when activity is finished it is not appearing in assignment list. But we can see that in global work list. When we initiate the workflow for some other item then along with new item the previous item also appear in the assignment list. I am feeling in the above scenario the second time when workflow start it triggers the previous workflow as well.

1 Answer 1

5

Activity instances don't expire. They get terminated or finished either manually or automatically through code.

It is likely that your ActivityInstance has ended, and it has become an ActivityHistory at the moment you are trying to finish it.

For the record: I notice you are using TOM.NET in your code. That is not officially supported (TOM.NET is only valid to be used inside templates and event system). Please consider using Core Service as supported API from workflow.

2
  • I am facing a very strange problem. The code which I deployed code yesterday night and test workflow for a number of components. It worked perfectly all right. I again tried running the workflow in morning then I found that work Item is not appearing assignment list. Code being used is same.
    – AlokBhatt
    Commented Oct 10, 2013 at 5:53
  • re your comment of 'It worked perfectly all right. I again tried running the workflow in morning then I found' - you should confirm if there are any services that are auto-restarted overnight that may have refreshed something to affect you in the morning. If you didn't restart the necessary services etc. last night then you may hav enot been testing the updated code. Commented Oct 10, 2013 at 15:44

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.