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


Zach 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 December 10, 2019 02:30)

This still returns nothing. I also tired the below with no luck: {% CurrentDocument.WithAllData['/alias/path/url'].GetValue("fieldname") |(identity)GlobalAdministrator%} 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 December 10, 2019 02:30)

Your syntax should look like so:

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

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 (last edited on December 10, 2019 02:30)

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") |(identity)GlobalAdministrator%}

0 votesVote for this answer Mark as a Correct answer

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