Capture the Originator to a Data field

  • 19 September 2006
  • 4 replies
  • 0 views

Badge +2
I have browsed through the knowledge base and the forums regarding methods of capturing the originator of a process. The method of choice is to create a data field and update this field with the information.

My question is, how is this done?

I have tried methods I have used successfully to update other data fields, but can not get this one to work.

Thanks,

JR

4 replies

Badge +9
All you should need to do is:

- Create a process datafield called "Originator".
- Within a Server Event, put the following line of code:

K2.ProcessInstance.DataFields["Originator"].Value = K2.ProcessInstance.Originator.FQN;


Please note the Originator is a K2ROM User object. FQN (Fully Qualified Name) is one of the properties. You may be interested in checking out if others are more approrpiate for you.
Badge +2
Please bear with me, I am not a code writer, but was assigned this task.

My server event has the following code:

Sub Main(ByVal K2 As ServerEventContext)
K2.Synchronous = True
K2.ProcessInstance.DataFields["Originator"].Value = K2.ProcessInstance.Originator.FQN
End Sub

I get the following errors when I compile the solution:

Line 3: Property access must assign to the property or use its value.
Line 3: Identifier expected

Thank you,

JR
Badge +9
I believe proper VB.NET syntax should be (note the "(" instead of the "[", which is C#):

K2.ProcessInstance.DataFields("Originator").Value = K2.ProcessInstance.Originator.FQN

Sorry for any confusion.

I hope this helps.
Badge +2
Bob,

Thank you, that fixes the problem.

JR

Reply