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 if 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 SmartForms 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

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 K2 forms back to using SharePoint forms, you can appify your secondary list or libraries without resetting the form links. See 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

K2 Cloud