Reusing K2 for SharePoint Data Objects

When you create an application from a SharePoint list or library, you create SmartObjects, SmartForms, workflows, and reports. The SmartObjects are the only required artifacts when integrating (creating a K2 application) a list or library because they are used to integrate with data from the list or library. The other artifacts you create are optional artifacts that use the SmartObjects.

When accessing lists and libraries that have the same data structure (those with identical columns) that are on the same SharePoint Web Application, you can appify each list or library or you can appify a primary list or library and use those SmartObject methods to access the secondary lists or libraries by using the Site URL and List ID parameters of the SmartObjects to point to those secondary lists and libraries.

For example, if you have an Employee list for staff in the USA (Employees_USA) and a separate employee list for staff in the European Union (Employees_EU), and another for staff in Asia/Pacific (Employees_APAC), and the data structure of all the lists are the same and are on the same SharePoint Web Application, then you can appify a primary list ( (Employees_USA) and use those SmartObject methods to access your secondary lists (Employees_EU and Employees_APAC). This gives you the ability to dynamically target different lists and libraries by using a single artifact so that you don't need to appify every list and library that requires K2 integration.

Reusing Primary List and Library SmartObjects for Secondary Lists and Libraries

Use the Site URL and List ID parameters of the SmartObject method to set the site of a secondary list or library. Shown here is a SmartObject method that accepts these optional parameters. Used without these parameters, the SmartObject retrieves data from the primary list or library. By specifying these parameters, you redirect the SmartObject to retrieve data from a secondary list or library.

The Site URL points to the SharePoint site where the list is. Include site and subsite values, such as https://sa-sp-current.denallix.com/HR/USA.

The List ID is the unique identifying number of the list.

The example below shows the Site URL and List ID used to execute the Get List Items method of the primary list (Employees_USA) and return the data from one of the secondary lists (Employees_EU) to the SmartForm.

Considerations

  • Create your K2 application on your SharePoint root list, then re-use those SmartObject methods to access your secondary lists on your sub sites.
  • The K2 App must be installed and activated on the site on which you create the primary K2 application.
  • You must activate K2 for SharePoint on site collections containing secondary lists and libraries before you can link them to primary lists and libraries.
  • Using a primary SmartObject method to access a secondary list only works on the same SharePoint Web Front-End (WFE), which can have multiple site collections with sub sites.
  • When you make changes to your primary list or library, you must re-appify it to update the associated SmartObject. Click the list or library menu and select the K2 Application icon. For more information see Changes to a SharePoint List or Document Library Structure
  • Any changes you make to the primary list or library must also be made to the matching secondary lists or libraries.
  • K2 for SharePoint artifact reuse only works for lists and libraries that are compatible with each other. The secondary list or library must have the same columns and column types as the primary list.
  • Reusing K2 for SharePoint application artifacts only works with SharePoint objects of the same type. You cannot appify a document library and reuse those artifacts with a list.
  • You cannot use Calendar lists with the K2 for SharePoint artifact reuse options. The Calendar list type does not include parameters used to link primary and secondary lists.
  • You cannot use lists or libraries with a lookup to a library with the K2 for SharePoint artifact reuse options.
  • When you attempt to create a K2 Application of a list or library that is linked to a primary list's K2 artifact, you see an error message stating "This list is re-using a K2 Application". You must remove the reuse links before you can appify the list or library. See Resetting the Secondary List or Library Links for the steps to detach the K2 Application from the secondary list or library.
  • For lists and libraries only appified with forms, if you change your primary list from using K2 forms back to using SharePoint forms, you can appify your secondary list or libraries without resettling the form links. See Working with SharePoint Forms for more information on using SharePoint forms.
  • You must refresh SmartObjects created before K2 Cloud Update 5 to enable the Site URL and List ID parameters.