Reusing K2 for SharePoint SmartForms

When you create an application from a SharePoint list or library, you create SmartObjects which are then used to create SmartForms when you choose the option to generate forms for the list or library.

When you create SmartForms for your list or library, you can link those forms to other matching, secondary SharePoint lists or libraries. You then see the SmartForms when you view the secondary lists and libraries in SharePoint. This is useful when you customize your SmartForms with a special layout of the columns or formatting of the text, and want to see those customizations on your other matching lists or libraries. Your primary SmartForm is used to display the data of those secondary lists or libraries.

For example, if you have regional staff employee lists (Employees_USA, Employees_EU, and Employees_APAC), and the data structure of all the lists is the same and are on the same SharePoint Web Application, you can appify a primary list (Employees_USA) with SmartObjects and SmartForms, and then use the SmartForms you customized for that list to view data from your secondary lists (Employees_EU and Employees_APAC). 

Reusing Primary List and Library SmartForms for Secondary Lists and Libraries

To link your secondary list or library you need the Site URL and List ID of your primary and secondary lists or libraries.

Use the following SmartObject methods to link your primary list or library SmartForms and your secondary lists or libraries.

First, run the Get SharePoint List Forms URL method of the SharePoint Integration Helper Methods system SmartObject.

Use your parent list or library's Site URL and List ID values as inputs. The method returns the following URLs

  • New Form URL
  • Edit Form URL
  • Display Form URL

Then run the Set Share Point List Forms URL method of the SharePoint Integration Helper Methods system SmartObject. Use your secondary list or library Site URL and List ID values as inputs, as well as the URL values returned from the first method. The secondary list or library is now linked to the SmartForm.

See How To: Create a SmartForm to link K2 for SharePoint Application SmartForm Reuse for an example of using these SmartObject methods.

Resetting the Secondary List or Library Links

When you need to remove the reuse links, such as if your secondary list is no longer part of the same set of lists and is customized with new columns just for that region, you must reset the list. You can then appify it and it becomes its own solution not linked to other solutions.

For SmartForm links, run the ResetSharePointListFormsUrl method of the SharePoint.Integration.HelperMethods system SmartObject. Use the Site URL and List ID values of the secondary list or library you're resetting as inputs to the method.

For lists and libraries only appified with forms, if you change your primary list from using SmartForms back to using SharePoint forms, you can appify your secondary list or libraries without resetting the form links. See Working with SharePoint Forms for more information on using SharePoint forms.

For workflow links, run the RemoveSharePointDynamicWorkflowLinking method of the SharePoint.Integration.HelperMethods system SmartObject. Use the Site URL and List ID values of the secondary list or library you're resetting as inputs to the method.

Considerations

  • Create your application on your SharePoint root list, then re-use those SmartObject methods to access your secondary lists on your sub sites.
  • The K2 for SharePoint App must be installed and activated on the site on which you create the primary 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 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 an Application of a list or library that is linked to a primary list's Nintex 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 Application from the secondary list or library.
  • For lists and libraries only appified with forms, if you change your primary list from using Nintex 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 Five Update 5.2 to enable the Site URL and List ID parameters.