Symptoms
Unable to create smartobjects for a list that's needed for a lookup column - Error Received
Diagnoses
When trying to create smartobjects for the site and sub-sites from a list that's being used for lookup on another list an error results.
I had a list with the same name previously but didn't have all the data so I deleted and created a new one with the same name so it seems like it's looking at a cache of some sort to the deleted list. I tried both via the list ribbon - K2 Application - as well as from the site contents and directly from the Appit Management area to create a new smartobject (see screenshot).
The details of the error are:
"• Type:
SourceCode.SmartObjects.Client.SmartObjectException
• Source:
SourceCode.SmartObjects.Client
• Method Base
○ Member Type:
Method
○ Name:
ExecuteScalar
○ Module
§ Scope Name:
SourceCode.SmartObjects.Client.dll
○ Declaring Type
§ Full Name:
SourceCode.SmartObjects.Client.SmartObjectClientServer
• Stack Trace:
at SourceCode.SmartObjects.Client.SmartObjectClientServer.ExecuteScalar(SmartObject smartObject, DataTable inputTable)
at SourceCode.Forms.AppFramework.FormRuntime.SmartObjectExecution(XPathNavigator nav, Boolean outputDependencies, SmartObjectClientServer svr)
at SourceCode.Forms.AppFramework.FormRuntime.WorkXmlToApi(String xml)
at SourceCode.Forms.Runtime.AJAXCall.ProcessRequest(HttpContext context)"
I did re-sync smartobjects on the list that the lookup column is being used on and an error resulted:
"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
Type: SourceCode.SmartObjects.Client.SmartObjectException
Source: SourceCode.SmartObjects.Client
Method Base
Member Type: Method
Name: ExecuteScalar
Module
Scope Name: SourceCode.SmartObjects.Client.dll
Declaring Type
Full Name: SourceCode.SmartObjects.Client.SmartObjectClientServer
Stack Trace:
at SourceCode.SmartObjects.Client.SmartObjectClientServer.ExecuteScalar(SmartObject smartObject, DataTable inputTable)
at SourceCode.Forms.SP15.Artifacts.AjaxHandler.GenerateForms(String siteurl, String sitetitle, String listid, String source)
at SourceCode.Forms.SP15.Artifacts.AjaxHandler.ProcessRequest(HttpContext context)"
The option to re-sync was no longer there after, however.
Resolution
After trying multiple times to reproduce this error I was unable to do so. One thing to note when creating templates is to check the "Include Content" checkbox on the Save As Template page. This should make the template available for use without issue. It appears that the issue was caused by using a template from a list that was deleted but since this error occurred only on this template this issue may have been caused by a GUID mismatch.
To create a list template follow these steps:
1. Select the specific list you are wanting to create a template from.
2. Using the List tab at the top of the page find the List Settings button next to the K2 section of the ribbon.
3. Select the Save List as Template item in the Permissions and Management section.
4. Give a file name, template name, and if applicable template description to the template. Check the include content box as well.
5. After saving the template go to your main landing page of your site and select the Add an App option.
6. In the applications page you should see the custom template you have created.
7. Select this template to add it and afterwards you should be able to Appify the new list as normal.
Keywords: SharePoint List Template SmartObject Error