How to retrieve document type item id for a given document

Jerreck McWilliams asked on October 15, 2015 17:26

Where in the database is a document related to a specific record in its document type table? I can't find a foreign key anywhere in CMS_Document, CMS_Class, or CMS_Tree that will allow me to pull a document's specific document type record and there doesn't appear to be a table that relates them anywhere.

I'm not looking to find a document's document type - that's pretty obviously referenced on CMS_Tree. I'm trying to find specifically which record in the doctype's table to pull for a given document. Where is that relationship stored?

Correct Answer

Jerreck McWilliams answered on October 15, 2015 17:44

Finally found it. The field is on CMS_Document. It's called DocumentForeignKeyValue. This is a FK to ItemID on the corresponding document type's table.

1 votesVote for this answer Unmark Correct answer

Recent Answers

Brenden Kehren answered on October 15, 2015 17:35 (last edited on October 15, 2015 17:35)

Use the already created views:


or your page type specific view:


Those views already have the document, tree and page type info coupled.

0 votesVote for this answer Mark as a Correct answer

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