Skip to main content
I have some process level datafields and some activity level datafields. The line rule coming out of the activity is evaluated based on the activity datafield.

Can somebody tell me how to change the value of the activity datafield?

Thanks
Typically, you would change the value of Activity datafields from within the EVENTS contained in the Activity. Whether this is through external UI pages or internal event code is completely up to you. If you're looking for specific syntax, please refer to the Help file.

Regards,
Ockert
Thanks Ockert,

I just have to look at K2ROM namespace to change the datafields from an external UI, right?

Also, Is K2ROM the only namespace that we use from Visual Studio.NET?
I got the following code from the help file:

Private Sub OpenWorklist(ByVal strK2Server As String, ByVal strWorkListItemSerial As String, ByVal strFolio As String, ByVal strNewDestination As String)
Dim oK2Connection As New K2ROM.Connection
Dim oWorkList As K2ROM.Worklist
Dim oWorkListItem As K2ROM.WorklistItem
'----------------------------------------------------------------------------------------------------------------------------------------
'Worklist for current Logged on user as specified in the Connection
'------------------------------------------------------------------------------------------------------------------------------------------------
Try
'Open Connection
oK2Connection.Open(strK2Server)

'Get Worklist for current Logged on User
oWorkList = oK2Connection.OpenWorklist("ASP")

For Each oWorkListItem In oWorkList
If oWorkListItem.SerialNumber = strWorkListItemSerial Then
'Update Process Data or XML Field
oWorkListItem.ProcessInstance.DataFields("Result").Value = "Complete"
oWorkListItem.ProcessInstance.XmlFields("Date").Value = Date.Today
oWorkListItem.ProcessInstance.XmlFields("Time").Value = TimeOfDay.Hour & ":" & TimeOfDay.Minute

'Update Activity Data or XML Field
oWorkListItem.ActivityInstanceDestination.DataFields("Result").Value = "Complete"
oWorkListItem.ActivityInstanceDestination.XmlFields("Date").Value = Date.Today
oWorkListItem.ActivityInstanceDestination.XmlFields("Time").Value = TimeOfDay.Hour & ":" & TimeOfDay.Minute

oWorkListItem.Update()
'OR
oWorkListItem.Finish()

ElseIf oWorkListItem.ProcessInstance.Folio = strFolio Then
oWorkListItem.GotoActivity("Declined", False) 'Force the process to another Activity contained in the same Process
'OR
oWorkListItem.Redirect(strNewDestination) 'Redirect the WOrkitem to a different user
'OR
oWorkListItem.Sleep(True, 24) 'Removes the workitem from the users worklist for the duration specified in seconds
End If
Next

-------------------------------------------

Here he's updating the DataFields of an activity from a worklist instance. When I tried the same it didn't work. The WorkListItem.ActivityInstanceDestination.DataFields is a ReadOnly property and I can't set the values.

Am I doing something wrong?

Any help is appreciated!

Thanks
Hello Ockert,

I finally got it working. But please do give me your comments and suggestions regarding this:

It throws an error if I use it like:
WLItem.ActivityInstanceDestination.DataFields("Approval").Value = "Approved"

But if I use it like this it works:

myDataField = WLItem.ActivityInstanceDestination.DataFields("Approval")
myDataField.Value = "Approved"

Please comment on this.

Thanks
No, sorry, I really can not see why this would be the case. I can not see the difference in the statements and I've got NO idea why the one would work and the other not - haven't seen this before.

Regards,
Ockert

Reply