How To Pull A Document Type Field Value From Another Page?

Dcode warner asked on May 6, 2017 01:19

This script doesn't work at all. I've changed the 'NodeID' and the 'FieldName' but nothing happens. IT just shows blank. This is implemented in a static HTML webpart. Is this the correct or an alternative way we can implement to full the value of the field from another page document type.

{% Documents.WithAllData[Documents.Where("NodeID=xxxxx")[0].NodeAliasPath].GetValue("fieldName") %}          

Recent Answers


Zachary Perry answered on May 6, 2017 18:36

I think you need to change nodeid to DocumentNodeId

0 votesVote for this answer Mark as a Correct answer

Dcode warner answered on May 6, 2017 20:47 (last edited on May 6, 2017 21:07)

This still returns nothing. I also tired the below with no luck: {% CurrentDocument.WithAllData['/alias/path/url'].GetValue("fieldname") %}

This works to pull the ID {% Documents.WithAllData["/"].GetValue("NodeID") %} But retrieving any subpage fails: {% Documents.WithAllData["/Sub"].GetValue("NodeID") %} So I believe the issue is getting the field from subpages are not working

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on May 6, 2017 22:51 (last edited on May 6, 2017 23:01)

Your syntax should look like so:

{% Documents["/Sub"].GetValue("NodeID") %}

You need to define a specific page ie: "/Sub" and no need to get the WithAllData because NodeID is part of the regular data.

Have you tried the macro debugger in Kentico? System>Macros>Console

0 votesVote for this answer Mark as a Correct answer

Dcode warner answered on May 6, 2017 23:20

I'm trying to get a field from another document type. Hence why I read somewhere I should use WithAllData. The field called "phone".

So neither of these are not working for me. (This on K7): {% Documents["/sub"].GetValue("phone") %} {% Documents["/sub"].WithAllData.GetValue("phone") %}

0 votesVote for this answer Mark as a Correct answer

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