Check "CurrentDocument" properties on Form tab

Brenden Kehren asked on December 3, 2015 18:05

Not sure why this isn't working this time because it did prior but I want to set visibility of some fields on the Form tab of a document.

{% if(CurrentDocument.NodeLevel == 2 && CurrentDocument.NodeAliasPath.Contains("/My-Page")){return true;}else{return false;} @%}

This should be returning true and display the field when I'm on this page /My-Page/Tester but it doesn't seem to. Assume this is only happening after a page has been created, so I'm performing an edit/update to it.

Correct Answer

Timothy Fenton answered on December 3, 2015 20:41

Hey Brenden! you should be able to do what Zach said, using a custom macro OR you could do something like:

{% EditedObject.NodeAliasPath.Contains("/Home") %}

this should work

3 votesVote for this answer Unmark Correct answer

Recent Answers


Zach Perry answered on December 3, 2015 19:49

The only luck I have ever had with the current document form tab, was when I would create a custom macro and use the nodeid from the query string.

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on December 3, 2015 20:00

What is the @ sign at the end of the macro for? I always see the security hash(#) instead of the @ sign. Is that a typo or does the @ sign at the end of a macro provide something?

2 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on December 3, 2015 20:07

You're probably right on that Zach. I forget those don't always work in the UI like that.

Josh, using the @ makes the macro unsigned. This way it doesn't run under a specific user. The majority of the simple macros I write, don't need permissions checked per user.

1 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on December 3, 2015 20:49

Thanks Tim! I forget about the EditedObject macro more often than not!

1 votesVote for this answer Mark as a Correct answer

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