Get custom field from page type using a macro

jeff McDaniel asked on August 2, 2017 23:24

Hi all,

I have a collection of page types with a "website" field.

Is it possible to get this value using a macro? The GetValue("website") expression is returning null.

I know in a transformation I can do Eval("Website"), I was looking for something similar outside of a transformation.

Thanks, Jeff

Recent Answers


Zachary Perry answered on August 2, 2017 23:30

Are you using CurrentDocument.GetValue("website") -- assuming the macro is on the page with the field?

1 votesVote for this answer Mark as a Correct answer

jeff McDaniel answered on August 3, 2017 22:38

Hi Zachm

I was hoping to get the value of a child page of the current document.

Jeff

0 votesVote for this answer Mark as a Correct answer

Zachary Perry answered on August 3, 2017 22:47 (last edited on August 3, 2017 22:48)

Not sure if this is the correct syntax, but it should be something similar to one of these:

{% Documents.WithAllData[CurrentDocument.Children[0].NodeAliasPath].GetValue("Website") #%}
{% Documents[CurrentDocument.NodeAliasPath].Children[0].WithAllData.GetValue("Website") #%}
{% CurrentDocument.Children[0].WithAllData.GetValue("website") #%}
0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on August 4, 2017 01:47 (last edited on August 4, 2017 01:49)

{%Documents.WithAllData[CurrentDocument.Children.FirstItem.GetValue("NodeAliasPath")].GetValue("Website")%)

1 votesVote for this answer Mark as a Correct answer

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