Reputation: 940
What Object type do we need to enter to select custom document types in the Uniselector control in Kentico v8?
In Kentico v7.0.34 we are successfully using the UniSelector to select custom document types as follows;
However in Kentico v8.0.17 we are getting the following error when using the above values;
[CustomTableItemProvider.GetTypeInfo]: Class 'custom.course' is not custom table.
Server Error in '/' Application.
[CustomTableItemProvider.GetTypeInfo]: Class 'custom.course' is not custom table.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: [CustomTableItemProvider.GetTypeInfo]: Class 'custom.course' is not custom table.
Source Error:
Line 1094: private void LoadObjects()
Line 1095: {
Line 1096: if (Object != null)
Line 1097: {
Line 1098: // Reset string builder
Source File: c:\Visual Studio\Projects\Kentico8\CMS\CMSAdminControls\UI\UniSelector\UniSelector.ascx.cs Line: 1096
We have tried changing the Object type as follows;
This results is the following error;
Object type 'custom.course' not found.
Server Error in '/' Application.
Object type 'custom.course' not found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: Object type 'custom.course' not found.
Source Error:
Line 1094: private void LoadObjects()
Line 1095: {
Line 1096: if (Object != null)
Line 1097: {
Line 1098: // Reset string builder
Source File: c:\Visual Studio\Projects\Kentico8\CMS\CMSAdminControls\UI\UniSelector\UniSelector.ascx.cs Line: 1096
I have read the documentation available here and for Object type it provides a Sample Value of "cms.user". Setting Object type to "cms.user" does work for selecting CMS Users.
I also created a custom table called "Test" and can confirm that setting Object type to "customtableitem.customtable.Test" does work for selecting custom table items.
I have also asked this on Kentico's dev.net Q&A site; https://devnet.kentico.com/questions/uniselector-in-kentico-v8
Cheers,
Darren
Upvotes: 0
Views: 879
Reputation: 7696
Quick answer:
ObjectType: cms.documenttype
Return column name: ClassID
Display name format: {%ClassDisplayName%}
Long answer:
Document type definitions (as well as custom table and on-line form definitions) are located in the CMS_Class table. To retrieve them you can use either more general "cms.class"
or rather specific "cms.documenttype"
or "cms.customtable"
object types. So you should be able to do the same using ObjectType: cms.class + Where condition: ClassIsDocumentType=1.
What you've been trying to do was to retrieve data rather than class definitions of the data. Data of so called "classes" are stored in their own tables. Each custom table has its own table, each on-line form has its own table and documents are stored in CMS_TreeNode/CMS_Document
tables.
Btw - there is already a form control for selecting classes. Have a look at:
\CMS\CMSFormControls\Classes\SelectClassNames.ascx
To distinguish between custom and predefined classes I'd suggest to use some prefix for your objects and select them with ClassName LIKE "myprefix%"
or simply use id condition ClassID > 4478
.
Upvotes: 1