none
waiting for 2 events to happen... RRS feed

  • Question

  • I have a manager approval state that I want to have wait for these two things to happen:

     

    the manager to update the item

    the manager to complete their workflow task

     

    since a state is event driven i don't understand how to make it wait for both events to fire before moving on to the next approval state.

     

    the way i have it now is there is an onTaskChanged event activity that has a while loop directly after it that was suppose to check for a field in the item to be filled in (a promoted column in the sharepoint list).

     

    i have a code block inside the while loop that reads as follows:

     

    Code Snippet

    SPSite site = new SPSite("http://spserv");

    SPWeb web = site.OpenWeb();

    SPUser manager = null;

     

    secondMgrName = workflowProperties.Item["2nd Manager Approval"].ToString();

     

    managerTaskID = Guid.NewGuid();

    manager = GetSiteUser(web, secondMgrName);

     

    if (manager.ToString() != null)

       secondManagerNotBlank = true;

     

     

    code for the getsiteuser function if your interested (no credit to me, i pulled it off of a blog) since supposedly spuser fields do not like blank values, but nulls are ok...

     

    Code Snippet

    private SPUser GetSiteUser(SPWeb web, string name)

    {

       foreach (SPUser user in web.SiteUsers)

       if ((user.Name.ToLower() == name.ToLower())||(user.ToString() == name))

          return user;

     

       return null;

    }

     

    to my point anyway, the while loop has a declarative rule condition that waits for the opposite of secondManagerNotBlank (i would put the " ! ", but it would be hard to see. then throws it out of the loop and moves on to the next approval state...

     

    only problem is it doesn't work, whether you complete the task first and then update the item, or update the item, then complete the task.

     

    so my question, how do you get the state to wait for 2 events to fire? I had thought about nesting a state within my approval state that handles the task, and then a parent event that waits for the onWorkflowItemChanged, but not sure how to impliment that exactly.

    Tuesday, June 5, 2007 9:38 PM

Answers

  • Well, I solved my problem, though I never found an actual answer to the above.

     

    I have the state point back to itself to create the second approval task instead of going to another state. (There was nothing wrong with the other state that I could see, but I did notice that some code was running from the state initilization activity)

     

    It works flawlessly now. Just required a bit more coding now to reset the state to make it setup the second task correctly and approve on to completion.

     

    I appreciate the help I was given!! Fabulous learning experience Smile

    Thursday, June 21, 2007 4:19 PM

All replies

  • The state will continue to capture events as long as you are in the state.  So you can have one eventDrivenActivity with OnTaskChanged and another eventDrivenActivity with OnWorkflowItemChanged (I think these are the two events you're waiting on?).  In the handler for each action set a boolean saying whether or not that part was completed.  In each eventDrivenActivity (after the On*Changed action) have an if/else: if both booleans are true go to the next state, else do nothing (and wait for the next event to capture).

    -Cynthia

     

    Tuesday, June 5, 2007 10:38 PM
  • Ah, thank you, I will try that today, as I was going to bed last night I gave it a long thought and came up with the same idea.
    Wednesday, June 6, 2007 2:01 PM
  • This is the error I receive if I try to update the form before editing the task:

     

    Value cannot be null.  
    System.InvalidOperationException: The event receiver context for Workflow is invalid.     at Microsoft.SharePoint.SPEventReceiverDefinition.ValidContext()     at Microsoft.SharePoint.SPEventReceiverDefinition.ValidReceiverFields()     at Microsoft.SharePoint.SPEventReceiverDefinition.GetSqlCommandToAddEventReceivers(IList`1 erds)     at Microsoft.SharePoint.Workflow.SPWinOESubscriptionService.CommitNewSubscriptions(Transaction txn, IList`1 erds) 
    Error in commiting pending workflow batch items: System.InvalidOperationException: The event receiver context for Workflow is invalid.     at Microsoft.SharePoint.SPEventReceiverDefinition.ValidContext()     at Microsoft.SharePoint.SPEventReceiverDefinition.ValidReceiverFields()     at Microsoft.SharePoint.SPEventReceiverDefinition.GetSqlCommandToAddEventReceivers(IList`1 erds)     at Microsoft.SharePoint.Workflow.SPWinOESubscriptionService.CommitNewSubscriptions(Transaction txn, IList`1 erds)     at Microsoft.SharePoint.Workflow.SPPendingWorkBatch.ProcessWorkItemBatch(Transaction transaction, Work method, IList`1 workItemBatch)     at Microsoft.SharePoint.Workflow.SPPendingWorkBatch.Commit(Transaction transaction, ICollection items)  
     WinWF Internal Error, terminating workflow Id# acf30817-ec17-4064-9dbc-2b6bd7efd51c

     

    This is the error I receive if I edit the task (approve the document) before I update the form:

     

    Engine RunWorkflow: System.Workflow.Activities.EventDeliveryFailedException: Event "OnTaskChanged" on interface type "Microsoft.SharePoint.Workflow.ITaskService" for instance id "b9efcc6b-f6ae-4bb0-8d29-cde4c728f4a7" cannot be delivered. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.     at System.Workflow.ComponentModel.Serialization.ActivitySurrogate.ActivitySerializedRef.System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(Object sender)     at System.Runtime.Serialization.DeserializationEventHandler.Invoke(Object sender)     at System.Runtime.Serialization.ObjectManager.RaiseDeserializationEvent()     at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)     at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)     at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)     at System.Workflow.ComponentModel.Activity.Load(Stream stream, Activity outerActivity, IFormatter formatter)     at System.Workflow.ComponentModel.Activity.Load(Stream stream, Activity outerActivity)     at System.Workflow.Runtime.Hosting.WorkflowPersistenceService.RestoreFromDefaultSerializedForm(Byte[] activityBytes, Activity outerActivity)     at Microsoft.SharePoint.Workflow.SPWinOePersistenceService.LoadWorkflowInstanceState(Guid instanceId)     at System.Workflow.Runtime.WorkflowRuntime.InitializeExecutor(Guid instanceId, CreationContext context, WorkflowExecutor executor, WorkflowInstance workflowInstance)     at System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext context, WorkflowInstance workflowInstance)     at System.Workflow.Runtime.WorkflowRuntime.GetWorkflow(Guid instanceId)     at System.Workflow.Activities.WorkflowMessageEventHandler.EventHandler(Object sender, ExternalDataEventArgs eventArgs)

         --- End of inner exception stack trace ---     at

    System.Workflow.Activities.WorkflowMessageEventHandler.EventHandler(Object sender, ExternalDataEventArgs eventArgs)     at Microsoft.SharePoint.Workflow.SPWinOETaskService.RaiseEvent(SPWinOeWorkflow workflow, SPWorkflowEvent workflowEvent, Object workItem, IPendingWork workHandler)     at Microsoft.SharePoint.Workflow.SPWinOeHostServices.Send(SPWinOeWorkflow winoeworkflow, SPWorkflowEvent e)     at Microsoft.SharePoint.Workflow.SPWinOeEngine.RunWorkflow(Guid trackingId, SPWorkflowHostService host, SPWorkflow workflow, Collection`1 events, TimeSpan timeOut) 

     

    The first error occurs in the w3wp.exe process, the second occurs in the owstimer.exe. Actually, the first error occurs regardless of updating the task first then updating the item.

     

    I wrote history logs directly after the On***Changed events that report the values of my boolean values that get checked in my ifElse activities, and they get set correctly.

     

    It seams that it hangs at the second On***Changed event. And I cannot find what is trying to write a null value.

     

    Here's my code for the On***Changed activities:

     

    OnWorkflowItemChanged:

    Code Snippet

    private void itemUpdatedWithFoodApproverInvoked(object sender, ExternalDataEventArgs e)

    {

       SPSite site = new SPSite("http://spserv");

       SPWeb web = site.OpenWeb();

       SPUser foodMgr = null;

     

       secondMgrName = workflowProperties.Item["Manager Food Approval"].ToString();

     

       foodMgr = GetSiteUser(web, secondMgrName);

     

       if ((foodMgr.ToString() != null) || (foodMgr.ToString() != ""))

          foodManagerNotBlank = true;

     

       web.Close();

       site.Close();

    }

     

     

    OnTaskChanged:

    Code Snippet

    private void onMgrTaskChanged(object sender, ExternalDataEventArgs e)

    {

       mgrIsApproved = bool.Parse(afterManagerTaskProperties.ExtendedProperties["mgrIsApproved"].ToString());

       mgrIsRejected = bool.Parse(afterManagerTaskProperties.ExtendedProperties["mgrIsRejected"].ToString());

     

       managerTaskProps.ExtendedProperties["mgrComments"] = afterManagerTaskProperties.ExtendedProperties["mgrComments"].ToString();

     

       if (managerTaskProps.ExtendedProperties["mgrComments"].ToString() != "")

          taskComments = managerTaskProps.ExtendedProperties["mgrComments"].ToString();

       else

          taskComments = "None";

     

       if (mgrIsRejected == true)

          rejectedBy = managerTaskProps.AssignedTo;

    }

     

    What's odd is that the task item shows in progress if the task is updated first then the item; if the item is updated first then the task item is changed, it says not started.

     

    So it hangs somewhere. I think something is going on when it dehydrates/rehydrates, but I am at a loss at this point, I may try recreating the state from scratch.

    Thursday, June 7, 2007 3:38 PM
  • I've gotten "event receiver context for Workflow is invalid" when I forgot to associate the BeforeProperties and AfterProperties with a field or if I use the wrong correlation token.  The fact that the first error occurs regardless of the order of your actions makes me think that the error is in the OnWorkflowItemChanged activity and has nothing to do with having both EventDriven activities in the same state. 

    For the OnTaskChanged, it does seem like there is a problem with serialization.  Does the workflow work correctly if you take out the OnWorkflowItemChanged activity and just have the OnTaskChanged activity?

     

    Good luck.

    -Cynthia

    Thursday, June 7, 2007 5:24 PM
  • Not sure, I removed the OnWorkflowItemChanged event, and I still receive an error. I don't think its exactly what I posted before, but similar.

     

    I get "the value cannot be null" error as soon as the item is updated (having NO OnWorkflowItemChanged activities) which seems crazy. Then on submission of the task form it acts like it doesn't go anywhere, you submit the form but the edit task bar reappears. if you do it the other way around, the workflow errors out.

     

    I have 3 ifElse Branches after the OnTaskChanged activity, 2 of them work (approval moving on to completing the workflow, and then rejecting) the third which will send it on for a second approval doesn't happen, which checks 3 boolean values (that i know get set correctly, so it must lie in the OnTaskChanged event)

     

    I'll try recreating my OnTaskChanged event and see what happens tomorrow.

     

    Do you think it could be a problem with checking a promoted field that gets updated through the item?

    Thursday, June 7, 2007 10:03 PM
  • Okay, that is bizarre.  When you say the third branch of the ifElse doesn't work, but the boolean is gettng set correctly, does that mean the workflow enters that third branch, but then doesn't go on to the next state like it is supposed to?

     

    Maybe it is a problem with the promoted fields.  Sorry I don't really have anything helpful to suggest.  If it isn't too involved, you might try just stripping down the workflow to get it back to a working state and then slowly adding functionality to see exactly where the problem is.

     

    -Cynthia

    Friday, June 8, 2007 5:12 PM
  • well...I have 3 values that get checked if the task is approved, if there's a food item that requires a second approval, and if the second approval manager box is filled in (this is the promoted column from the form in the sharepoint list. Which displays correctly after updating the form.

     

    I have played with it and got some extra specially weird errors, and finally got it back to "Value cannot be null."

     

    This "value cannot be null" happens in the second event that fires, whether it be the OnTaskChanged event or the OnWorkflowItemChanged.

     

    Is there something in the state that gets set if an event gets triggered? Or I'm also wondering if the event that has already fired sticks around and stays instantiated (I think is the term I want to use) so when the other one fires it receives the same context that the former event used or is using...so I wonder if it tries to send a null value because its already in use[?] and the second event dies in process (not really dies, but it hangs, if the onTaskChanged event is fired second, the task gets locked and you cannot edit it (also displays that the task is "Not Started" in the status of the task).

     

    I do have the after properties assigned a variable, but not the before properties and haven't had a problem with it before, so I'm pretty sure that's not my problem now.

     

    I debugged my workflow, and it steps completely through like nothing's wrong, but the SharePoint log shows that event receiver error from above.

     

    I get this error after the workflow infrastructure error...

     

    Potentially excessive number of SPRequest objects (9) currently unreleased on thread 1.

     

    it goes on with lots of lines after that...

     

    Tuesday, June 12, 2007 9:50 PM
  • Sorry for the long delay in my response.  Unfortunately, I don't have any good answers for you so hopefully you've already figured this one out.  In case you haven't, I've thought of a couple more things to check.  I'm sure you've already checked most (if not all) of them, but you never know.

     

    I'm assuming you create the task and then wait on the various events all in the same state.  Something like:

    stateInitializationActivity1 - create task

    eventDrivenActivity1 - wait for OnTaskChanged, followed by If/Else branch that either moves to a different state (complete the workflow), moves back to the current state (to create a new approve task), or does nothing (continues to wait for more activities)

    eventDrivenActivity2 - wait for OnWorkflowItemsChanged and set some boolean values.

     

    Is that right?

     

    If another approval is required, you loop back up to the same state (i.e. setState pointing to the current state) in order to create that new approve task, right?  If so, make sure the task correlation token's OwnerActivityName is the state scope and not the workflow scope.  That way a new correlation token will be automatically created for this new instance of the state.

     

    Make sure the correlation token for the OnWorkflowItemChanged event is the workflowToken.

     

    Make sure the correlation token of the OnTaskChanged event is the taskToken.

     

    I'm sorry I can't be more helpful.

    -Cynthia
    Friday, June 15, 2007 7:39 PM
  • Actually, I have 3 states I use for approval, I never even thought of reusing the same state; but, on that note, all 3 states I use for task creation for each approval that's needed. All the correlation tokens are set correctly. Each task has its own token, owner activity is set to the corresponding state. The onWorkflowItemChanged events' correlation tokens are set to the workflow token.

     

    I have tried several different things: a new list, publishing the form that the workflow work against as a content type, using a different promoted field, using a different variable in my code to store the value for the column, having the first state be the second approval, checking the permissions of the application pool, site collection, list, and item (which, we were actually able to fix something we were having a problem with in SharePoint when we changed some settings in the central administration).

     

    I have been researching this thing pretty hard core the last couple days and have come across a blog, I don't have the link right now (since I'm at home), but I will post it up on monday. She was talking about the exact same errors I was getting, that would normally be a problem with correlation tokens, but said it was an actual SharePoint error that was occurring, something to do with the timer or a synchronization issue. It errors out in the batch process I think. We get a lot of "The SPRequest yada yada hasn't been released in the current thread" or something like that (sorry for that detailed error there, probably shouldn't be posting this at 1am from home huh?). Not sure if its directly related to the workflow, but seems to occur when an item is submitted to the list and the workflow gets instantiated against the item. There is a hotfix for this error, but its not public, and you have to call Microsoft, so I had made my first attempt to contact Microsoft today, but had to get off the phone after waiting a half hour. I'll try again on Monday.

     

    The only thing I haven't done yet is recreate my workflow from scratch, which I'm hesitent to do because we're getting down to the wire on doing this demo for our company (yes we haven't fully implimented MOSS yet, so this form and workflow is suppose to be a selling point to senior management, along with a demo of the SharePoint site).

     

    Anyway, like I said, I'll try to post up some more of my research on monday regarding this issue and try to get the KB article that I suspect may be related to my problem.

     

    Aaron

    Saturday, June 16, 2007 6:39 AM
  • I figured that I'd post my finds while waiting for a Microsoft SharePoint tech on the phone...

     

    http://blogs.tamtam.nl/lucy/

     

    She's got a few fixes/KB articles on some bugs that occur in workflows.

     

    I cleaned up my code a bit and got cleaner errors....but its still broken Smile

     

    I think there are some workflow instances that are still persisted for some reason, and that might be causing my errors...

     

    Value cannot be null. 
    System.InvalidOperationException: The event receiver context for Workflow is invalid.
         at Microsoft.SharePoint.SPEventReceiverDefinition.ValidContext()     at Microsoft.SharePoint.SPEventReceiverDefinition.ValidReceiverFields()     at Microsoft.SharePoint.SPEventReceiverDefinition.GetSqlCommandToAddEventReceivers(IList`1 erds)     at Microsoft.SharePoint.Workflow.SPWinOESubscriptionService.CommitNewSubscriptions(Transaction txn, IList`1 erds) 
    Error in commiting pending workflow batch items: System.InvalidOperationException: The event receiver context for Workflow is invalid.     at Microsoft.SharePoint.SPEventReceiverDefinition.ValidContext()     at Microsoft.SharePoint.SPEventReceiverDefinition.ValidReceiverFields()     at Microsoft.SharePoint.SPEventReceiverDefinition.GetSqlCommandToAddEventReceivers(IList`1 erds)     at Microsoft.SharePoint.Workflow.SPWinOESubscriptionService.CommitNewSubscriptions(Transaction txn, IList`1 erds)     at Microsoft.SharePoint.Workflow.SPPendingWorkBatch.ProcessWorkItemBatch(Transaction transaction, Work method, IList`1 workItemBatch)     at Microsoft.SharePoint.Workflow.SPPendingWorkBatch.Commit(Transaction transaction, ICollection items) 
    WinWF Internal Error, terminating workflow Id# 7cb2d062-e65b-4fa7-b8f2-1360036fc3f8 


    Engine RunWorkflow: System.Workflow.Activities.EventDeliveryFailedException: Event "OnWorkflowItemChanged" on interface type "Microsoft.SharePoint.Workflow.ISharePointService" for instance id "7cb2d062-e65b-4fa7-b8f2-1360036fc3f8" cannot be delivered. ---> System.Runtime.Serialization.SerializationException: The object with ID 122 implements the IObjectReference interface for which all dependencies cannot be resolved. The likely cause is two instances of IObjectReference that have a mutual dependency on each other.     at System.Runtime.Serialization.ObjectManager.GetCompletionInfo(FixupHolder fixup, ObjectHolder& holder, Object& member, Boolean bThrowIfMissing)     at System.Runtime.Serialization.ObjectManager.CompleteObject(ObjectHolder holder, Boolean bObjectFullyComplete)     at System... 
    ....Runtime.Serialization.ObjectManager.DoFixups()     at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)     at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)     at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)     at System.Workflow.ComponentModel.Activity.Load(Stream stream, Activity outerActivity, IFormatter formatter)     at System.Workflow.ComponentModel.Activity.Load(Stream stream, Activity outerActivity)     at System.Wor... 
    ...kflow.Runtime.Hosting.WorkflowPersistenceService.RestoreFromDefaultSerializedForm(Byte[] activityBytes, Activity outerActivity)     at Microsoft.SharePoint.Workflow.SPWinOePersistenceService.LoadWorkflowInstanceState(Guid instanceId)     at System.Workflow.Runtime.WorkflowRuntime.InitializeExecutor(Guid instanceId, CreationContext context, WorkflowExecutor executor, WorkflowInstance workflowInstance)     at System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext context, WorkflowInstance workflowInstance)     at System.Workflow.Runtime.WorkflowRuntime.GetWorkflow(Guid instanceId)     at System.Workflow.Activities.WorkflowMessageEventHandler.EventHandler(Object sender, ExternalDataEventArgs eventArgs)     --- End of inner exception stack trace ---     at System.Workflow.Activ... 
    ...ities.WorkflowMessageEventHandler.EventHandler(Object sender, ExternalDataEventArgs eventArgs)     at Microsoft.SharePoint.Workflow.SPWinOEWSSService.RaiseEvent(SPWinOeWorkflow workflow, SPWorkflowEvent workflowEvent, Object workItem, IPendingWork workHandler)     at Microsoft.SharePoint.Workflow.SPWinOeHostServices.Send(SPWinOeWorkflow winoeworkflow, SPWorkflowEvent e)     at Microsoft.SharePoint.Workflow.SPWinOeEngine.RunWorkflow(Guid trackingId, SPWorkflowHostService host, SPWorkflow workflow, Collection`1 events, TimeSpan timeOut) 

    the second colored text refers to an event that is never called in my workflow (possibly something in an older instance).

     

    I still get the value cannot be null though...and it ONLY happens when i read a value from the column and the ontaskchanged event is called. otherwise its fine (doesn't matter when i read the column either, if i read it initially when the workflow is initiated against the item, or when i actually get to the point when i need the value (the onworkflowitemchanged event).

     

    There is nothing different in that column that would be different from other values I pull in from the list.

     

    I

    Tuesday, June 19, 2007 4:37 PM
  • Well, I solved my problem, though I never found an actual answer to the above.

     

    I have the state point back to itself to create the second approval task instead of going to another state. (There was nothing wrong with the other state that I could see, but I did notice that some code was running from the state initilization activity)

     

    It works flawlessly now. Just required a bit more coding now to reset the state to make it setup the second task correctly and approve on to completion.

     

    I appreciate the help I was given!! Fabulous learning experience Smile

    Thursday, June 21, 2007 4:19 PM
  • Hi Aaron

     

    I think you can help me to resolve the same error. I am getting following exception with OnTaskCreated activity.

    I've posted this in details at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1765809&SiteID=1 .

     

     

     

    Engine RunWorkflow: System.Workflow.Activities.EventDeliveryFailedException: Event "OnTaskCreated" on interface type "Microsoft.SharePoint.Workflow.ITaskService" for instance id "bf3a33ec-9b5c-4121-b51b-0106c3749698" cannot be delivered. ---> System.Runtime.Serialization.SerializationException: Cannot get the member 'OnTaskCreated_MathodInvoking'.     at System.Reflection.MemberInfoSerializationHolder.GetRealObject(StreamingContext context)     at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder holder)     at System.Runtime.Serialization.ObjectManager.DoFixups()     at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)     at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)     at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)     at System.Workflow.ComponentModel.Activity.Load(Stream stream, Activity outerActivity, IFormatter formatter)     at System.Workflow.ComponentModel.Activity.Load(Stream stream, Activity outerActivity)     at System.Workflow.Runtime.Hosting.WorkflowPersistenceService.RestoreFromDefaultSerializedForm(Byte[] activityBytes, Activity outerActivity)     at Microsoft.SharePoint.Workflow.SPWinOePersistenceService.LoadWorkflowInstanceState(Guid instanceId)     at System.Workflow.Runtime.WorkflowRuntime.InitializeExecutor(Guid instanceId, CreationContext context, WorkflowExecutor executor, WorkflowInstance workflowInstance)     at System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext context, WorkflowInstance workflowInstance)     at System.Workflow.Runtime.WorkflowRuntime.GetWorkflow(Guid instanceId)     at System.Workflow.Activities.WorkflowMessageEventHandler.EventHandler(Object sender, ExternalDataEventArgs eventArgs)     --- End of inner exception stack trace ---     at System.Workflow.Activities.WorkflowMessageEventHandler.EventHandler(Object sender, ExternalDataEventArgs eventArgs)     at Microsoft.SharePoint.Workflow.SPWinOETaskService.RaiseEvent(SPWinOeWorkflow workflow, SPWorkflowEvent workflowEvent, Object workItem, IPendingWork.workHandler)     at Microsoft.SharePoint.Workflow.SPWinOeHostServices.Send(SPWinOeWorkflow winoeworkflow, SPWorkflowEvent e)     at Microsoft.SharePoint.Workflow.SPWinOeEngine.RunWorkflow(Guid trackingId, SPWorkflowHostService host, SPWorkflow workflow, Collection`1 events, TimeSpan timeOut)    

    Thursday, June 21, 2007 4:44 PM
  • Hi Aaron,

    I'm glad you got this working.

    Just curious, when you had the workflow moving on to a new state to create the next approval task, did you have the CompleteTask activity in the StateFinalization of the old state?  I'm just trying to figure out what SharePoint is doing that would make it work when pointing back to the same state, but not when you move to a new state.  The only thing I can think of is that going back to the same state forces some sort of automatic cleanup by SharePoint.  Otherwise the two ways of doing it seem exactly the same - either way you get a new taskID, new properties, new correlation token, etc.

    Anyway, congrats.

    -Cynthia

    Thursday, June 21, 2007 4:50 PM
  • Yeah, I have the complete task in the state finalization. Seems that in the batch process, it processes the end of the first state and the beginning of the second state at the same time. Doesn't make sense to me.

     

    Like I had said though, I noticed some permissions were getting set that I had coded in the second state, but the first task was not completing (let alone showing "In Progress" depending on the order I did things), and the second task was not getting created. Which led me to believe SharePoint was doing something funky, since my code was firing. I'm going to leave this issue in limbo and if I run into something like this again, to think further outside the box on fixing it. Too bad it took 2+ weeks on figuring this out.

     

    Thanks again,

     

    Aaron

    Thursday, June 21, 2007 5:51 PM
  • Thursday, June 21, 2007 7:38 PM