Uniselector in Kentico v8

Darren S asked on August 4, 2014 02:19

In Kentico v7.0.34 we are successfully using the UniSelector to select multiple custom document types.

  • Object type: customtableitem.custom.Course
  • Return column name: CourseID
  • Display name format: {%Name%}
  • Selection mode: Multiple
  • Order by: Name

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.

We have tried changing the Object type as follows;

  • Object type: custom.Course

This results is the following error;

Object type 'custom.course' not found.

I have read the documentation available here and it provides a Sample Value of "cms.user". I can confirm that setting Object type to "cms.user" does work.

I also created a custom table called "Test" and can confirm that setting Object type to "customtableitem.customtable.Test" does work.

So it looks like our problem relates to selecting custom document types.

Cheers,

Darren

Recent Answers


Joshua Adams answered on August 4, 2014 15:04

You could try to look up the value that is stored under the cms_class table for the course custom table.

If it is stored in a custom table, you have to reference it like this:

CustomTableItem.ClassName

Assuming that custom is the namespace: CustomTableItem.custom.Course

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on August 4, 2014 18:15

There is a good chance that "custom" is a reserved name or is hardcoded to some degree like the primary key field name for custom tables. Only reason I say that is because your customtable.test object works and custom.course does not. Try creating a customtable.course or cloning the original course table.

0 votesVote for this answer Mark as a Correct answer

Darren S answered on August 5, 2014 00:48

@Joshua Thanks for you reply. Below are some values from the CMS_Class table which I hope are relevant;

  • ClassDisplayName = Course
  • ClassName = custom.Course
  • ClassTableName = custom_Course
  • ClassIsDocumentType = 1
  • ClassIsCoupledClass = 1
  • ClassIsCustomTable = 0
  • ClassIsMenuItemType = NULL

Cheers,

Darren

0 votesVote for this answer Mark as a Correct answer

Darren S answered on August 5, 2014 01:17

@Brenden I just tried creating a new Document Type to try to avoid using 'Custom' in the Namespace.

This time I created a Document Type with Namespace=MyNamespace and Name=MyDocumentType.

Looking in the CMS_Class table the ClassName=MyNamespace.MyDocumentType.

In the Uniselector I set the Object type=MyNamespace.MyDocumentType and I get the same error as before;

Object type 'mynamespace.mydocumenttype' not found.

As a work around I am using the List box control, ticked Allow multiple choices and am using the following SQL Query for the Data Source;

SELECT CourseID, Name FROM dbo.View_custom_Course_Joined ORDER BY NodeOrder

This workaround does meet the requirement of selecting multiple Documents. But in v7 our CMS Editors preferred to use the Uniselector.

Cheers,

Darren

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on August 5, 2014 15:05

Instead of having customtableitem.custom.Course, Captitalize it like CustomTableItem.custom.Course

0 votesVote for this answer Mark as a Correct answer

Darren Stahlhut answered on August 5, 2014 23:36

@Joshua I just tried setting Object type=CustomTableItem.custom.Course it returns the following error;

[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 

Thanks for your help, should I ask support?

Darren

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on August 6, 2014 15:00

Capitalize the class exactly as it is stored in the db.

Instead of custom.course, should be custom.Course

This should fix it I would imagine.

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on August 6, 2014 15:19

I see that this already seems to have been set above, sorry, editing posts should be allowed(this happens too often)

In that case, it seems like everything is set up correctly. As long as you are sure that the item that you are loading in is from a custom table, it looks correct. You may want to check and see if it actually is, because I would imagine that this right here ClassIsCustomTable=0 would mean that it's not. If your table is under system table(aka module-class) then you don't need CustomTableItem, just put custom.Course as the object type.

0 votesVote for this answer Mark as a Correct answer

Darren Stahlhut answered on August 6, 2014 15:40

@Joshua It's not a custom table, it is a Document Type.

It has the following database objects;

  • dbo.custom_Course
  • dbo.View_custom_Course_Joined

I've tried custom.Course and it doesn't work (see the error my original post).

For some reason in v7 it does work with customtableitem.custom.Course even though it is not a custom table.

+1 on being able to edit.

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on August 6, 2014 15:43

Sorry I didn't realize that until now(oops), I would send Kentico a note and ask if you need a specific prefix, or if it is allowed to put a doc type in the uniselector. I haven't ever had to do that. Let us know what you find out, because that's very useful info.

0 votesVote for this answer Mark as a Correct answer

Darren Stahlhut answered on August 12, 2014 03:03

Thank you to Kentico Support who have provided an answer for this.

We can select multiple Documents by setting the following;

  • Object type: cms.document
  • Return column name: DocumentForeignKeyValue
  • Display name format: {%DocumentName%}
  • Selection mode: Multiple
  • Where condition: ClassName = 'custom.Course'
  • Order by: DocumentName

Cheers,

Darren

0 votesVote for this answer Mark as a Correct answer

Rananjay Singh answered on February 13, 2015 08:07

[CustomTableItemProvider.GetTypeInfo]: Class 'custom.course' is not custom table.

use "custom_course" intend of "custom.course" now it is working fine.

string customTableClassName = "custom_delivery_options"; DataSet dataSet = CustomTableItemProvider.GetItems(customTableClassName).Where(where).TopN(topN).Column(columns);

0 votesVote for this answer Mark as a Correct answer

mallesh Doddi answered on December 7, 2016 10:56

Hi ,

I have a question in Uni selector, How can we manipulate the Display Name Format Field. I mean if Display name field will show the first name and Last name (In macro{%FirstName%}{%LastName%}).We will see as Mallesh Doddi(example) in form tab.But Here I need only first name and Initial in last name(Mallesh D). Please help.

Thanks in advance.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.