Symptoms
Configure Item Reference in Visual Studio
Diagnoses
Hi, I have a workflow that I builded in k2 for Visual Studio.
I configured a SmartObject as an Item Reference and passed it between Activities as a DataField, and it works fine.
However, I need to start that workflow from a WCF Service and I do not know how to replicate that functionality into my code.
Resolution
There is not an available API that makes the item reference available.
I believe an item reference was intended to replaces the Identity Field/Data Field configuration in Smartforms 1.0.2 and prior releases to only make it easier and quicker to design a workflow.
- If the SmartObject is bound to a List View or an Editable List View, the Item Reference will automatically bind to the default List method of that SmartObject.
- If the SmartObject is bound to an Item View, the Item Reference will automatically bind to the first Load method found in that SmartObject.
Reference:
http://help.k2.com/kb001367
As such, this only provides read access to the Smartobject data that is bound to the view. If you wish to gain access to a field that the item reference surfaces you can create a datafield and then use a data transfer event in the workflow to map the item reference field to the data field. Alternatively, you can also access the same data using the Smartobject API as the item references is essentially executing the list/load method of the Smartobject it is bound to.