how to relate custom pagetype to cms_Document?

kyle shapiro asked on May 3, 2018 22:34

I want to query all the CMS_Document.[documentName]s where custom_page_type.[custom_field] = 'Y'. How in Kentico's database do you relate a custom table (representing a pagetype you've created) to CMS_Document? I'm on version 8.2 if it matters.

Correct Answer

Peter Mogilnitski answered on May 4, 2018 00:52

in 8 you still have views for each custom page type: select DocumentName, * from View_[custom type table name]_Joined where [custom_field] = 'Y'

If we take articles type as example your view is called: select * from View_CONTENT_Article_Joined

to find appropriate view SELECT * FROM sys.views where name like '%atricle%' i.e. find me all views with article word in it.

P.S. To make without any view and work in any version you just do (if we use article type as example)

SELECT DocumentName,* from View_CMS_Tree_Joined
JOIN CONTENT_Article on DocumentForeignKeyValue = ArticleID and ClassName ='CMS.Article'
WHERE ArticleName = 'bla bla'

This above will work in any version

2 votesVote for this answer Unmark Correct answer

Recent Answers


kyle shapiro answered on May 7, 2018 19:46

Thank you Peter. That is exactly what I was looking for.

0 votesVote for this answer Mark as a Correct answer

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