Get Process Datafields with Process Name

  • 25 November 2014
  • 1 reply
  • 1 view

Badge +10

Hi all,

 

Is it posible to get the datafeilds that a process has without starting the process. For example, I have the processname, is it posible (using the K2 Api) to pass a method the processname and then it will passme back a list of datafields that the latest process has.

 

I am able to create a proces instance using the CreateProcessInstanceMethod and then looping throught the created processinstance's datafileds.

What I want to do is, before the procesinstance is even created, I want to get a list of datafields.

 

Ideally, if this is possible through the K2 api that would be great.

 

Hope that makes sense.

Thanks in advance

 

 

 

 


1 reply

Badge +8

I believe if you call CreateProcessInstance() WITHOUT calling StartProcessInstance(), this accomplishes what you want.  However, its been a while since I looked at this particular part of the API, so I could be mistaken.

 

Another option would be to create "mapping" files that contain details of the process you are fetching, e.g. fields, data types, SmartObject names, etc.  We opted to do this via XML files, but you could do this via multiple other options as well.  We have a library that handles all of the .NET object to K2 process interactions for us, including starting a process, editing a process, actioning a worklist item, etc.  We considered what you are trying but found several limitations.  First, guessing property names in the .NET objects is not a good idea.  Second, there was no easy way to handle process versioning (i.e. a data field only exists if the process version >= x).  Third, data type conversions were also a pain.  In the end, we scrapped the "implicit mapping" approach and opted for "explicit" mapping files to simplify the whole mess for us.

Reply