Skip to main content

Hello,


my default task activity looks like this:



  1. SmartObject: CreateTask Event
  2. InfoPath Client Event
  3. SmartObject: UpdateTask Event

The purpose of the SO Task is to store the people who carry out the task and a given taskcomment. This is used as an own smal Workflow History.
Within the form (open rule) I store fields with the user who opens the form (displayname, email, account eg) and I have fields for the task action and task comment.


In UpdateTask Event I update my created SO Task entry with this fields, also I use the task action field from the form to store the action the destination user has done. All works fine - BUT if I allow handling actions directly over the worklist than of course all my form fields are not set.


Questions:



  • The activity data fields Outcome and Action Results do not contain any values. I expected that I can find the task action the user used in one of these fields. Why not?
  • I try to solve my batch problems by using code in the succeeding rule of the activity (see Johnny's great article: Updating Batch Action/Outcome results back into InfoPath form) - but this changes are not available during UpdateTask. When do this rule run?

Anja


 

Sorry - I miss an important detail.


I try to use Plan per Destination, all at once - but the destination is only one role so I have only one slot. This seems to act nearly as the default Plan just once - but I hope I will find the activity instance fields filled than - but this did'nt work as expected.


Johnny wrote another good article (Differences between "Plan just once" and "Plan per destination") - I read it - but sorry I'm still confused with this options.


I try to use also Plan just once and than the slot collections: K2.ActivityInstanceDestination.ActivityInstance.WorklistSlots[0].DataFields["Action Result"].Value.ToString();


But during build I get the error: Error 2 'Project_8607830a347f44759e95738a818e9eea.SucceedingRuleContext_53f3d1859467434d851da3f2d84f0af4' does not contain a definition for 'ActivityInstanceDestination' 


That line can only be used in a server event within the Activity Instance.


If you want to use it in the succeeding rules, use this line instead.


K2.ActivityInstance.WorklistSlots[0].DataFields["Action Result"].Value.ToString();


Thx Johnny - this works.


Can you explain me why the changes to the form are not available during my UpdateTask? If I move the event to the next activity it works - but not if the event is directly behind the infopath client event in the same activity.


From my understanding (at least in K2.net 2003), the infopath client event copies the form XML data from the Process level XML field to the activity level XML field.  When the succeeding rule is reached, the activity level XML field is copied back to the Process level XML field.  So if you want to do any updates, you would modify the activity level XML field.


 Now I might be wrong here but I think the behaviour has not changed in blackpearl.  So I guess that you should be modifying the activity level XML field to update your form status.


This sounds good but I try this -


First I try with K2.ActivityInstance.XmlFieldss_xmlFieldName] but I got a runtime error "xmlfield not found".


Then I try: K2.ActivityInstance.WorklistSlotst0].XmlFieldsd_xmlFieldName] this runs but I found no changes during my UpdateTask Event. It seems "to late", because in this version I also get no changes if I move my Update Task Event to the next activity.


So I guess that when I reach the succeding rule the copy back is already done - but why do the next Event handels with "old" Form fields?


(I use now the Plan at once - because Plan per destination didn't help me)


Reply