This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.
K2 Studio or K2 Designer for Visual Studio Workflows, that use a data event to transfer a SharePoint Lookup column value to a Data Field will not populate with any data. This data event uses the GetListItems method on a Sharepoint list SmartObject as the source, and a data field as a destination.
-Running the Smartobject call outside of the workflow will properly return expected data.
-This behavior shows across all data events configured to make a call with the lookup column as an input for the GetListItems Method.
-This same workflow transferred data properly before, on version 4.6.10 (or below) of K2 Blackpearl.
-Hard coding the data event in a workflow to use a different column that is not a lookup will properly return data.
This is expected behavior as the GetListItems method has limitations and can not provide an all around functionality when used in workflows. Between 4.6.10 and 4.6.11 the methods were changed and to have an all around method the GetListItemsWithMethodOptions SmartObject method was added to Sharepoint SmartObjects. This method will properly pull back data from a lookup column. Additionally there are multiple other designs that could provide you with proper functionality.
1. The GetListItemsWithMethodOptions SmartObject method will properly filter on the lookup column value supplied.
2. Using the GetListItems method and instead giving the Lookup column ID in the SmartObject call input will return proper values from SharePoint.
3. Using the SmartObject Event in the workflow designer with the lookup column value will properly return the desired value
4. Supplying a value for the GetListItems method in a data event that is not for a lookup type column will return data. This will require more of a design change as it is not guaranteed that another column would be viable to return the proper data. Using a new column with same lookup values as just a text column could also be a viable solution.
We did see a difference in behavior between the Data Event and SmartObject Event wizards being used. The reason we see the failure with a Data Event but not with a similarly configured SmartObject event is due to the fact that the Data Event enables paging by default. The SmartObject event does not have this enabled. Paging is one of the limitations that the GetListItems method has but the GetListItemsWithMethodOptions will properly work with.