Node Alias of Parents Parent in Transformation

James Cotter asked on May 28, 2014 23:38

HI

I ant to get the NodeAlias value of my parents parent in a transformation. Is something like this possible in a transformation without writing a custom function?

I've tried: <%# CMSContext.CurrentDocument.Parent.Parent.GetValue("NodeAlias") %> <%# CMSContext.CurrentDocumentParent.Parent.GetValue("NodeAlias") %>

Any help would be much appreciated.

Thanks James

Recent Answers


Yehuda Lando answered on May 29, 2014 05:55

This works for me in K#: {% CurrentDocument.Parent.Parent.NodeAlias #%}

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on May 29, 2014 06:19

To use Yehuda's suggestion, you have to use this syntax

<%# CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{% CurrentDocument.Parent.Parent.NodeAlias #%}") %>

Reason why is Yehuda is using a K# Macro and you (James) are using C# code. You have to have the C# wrapper around the macro for it to work properly.

1 votesVote for this answer Mark as a Correct answer

James Cotter answered on May 29, 2014 07:03

Thanks for the responses, much appreciated.

Unfortunately, unless I am missing something, it is not returning anything for me using this in my transformation:

<%# CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{% CurrentDocument.Parent.Parent.NodeAlias #%}") %>
0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on May 29, 2014 07:51

Have you checked the event logs?

0 votesVote for this answer Mark as a Correct answer

James Cotter answered on May 30, 2014 00:36

Nothing in the logs and no error on the page it just displays nothing?

0 votesVote for this answer Mark as a Correct answer

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