Module UI Visibility Issue

Aaron Hayon asked on February 29, 2016 21:44

I am currently trying to control the visibility of a module ui screen based on the type of page. I currently am using the following for the Visibility under the Element Restrictions in the User Interface for a module I created.

(CurrentDocument.NodeClass.ClassName == "EPP.Presentation")

Basically, I have updated the Pages UI section to show a tab for presentation to capture presentation times. It is a business requirement that when the user creates the presentation page, that I collect the list of times and associated metadata at the same time.

When I use the macro, in the visibility section of the module ui, the tab never displays. If I put the same logic in the page itself using an html editor, the value is true for any document that has a page type of EPP.Presentation. Why does this not work in the visibilty of the module ui?

Recent Answers

Trevor Fayas answered on March 1, 2016 00:11

I could be wrong, but the Module UI webpart may not be using the same Macro Resolver that the normal pages uses, which may mean in an HTML editor it has that context of "CurrentDocument" but not in the Module UI.

If you go to System -> Macros -> Report, and select the object type of "UI Element" i do not see a CurrentDocument in it's context. But check through the available options and see if you can find something that you can use instead (Maybe EditedObject.FormClassID?)

It may also be possible to simply implement a custom macro to do the logic you need...

0 votesVote for this answer Mark as a Correct answer

Aaron Hayon answered on March 1, 2016 01:19

Thanks for the info Trevor. I was not aware of that feature in the system application. I took a look and I am not sure any of them will work. I wonder if this would be better implemented using a UITabExtender?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on March 2, 2016 05:45

Trevor is right, you can get what you need by using the EditedObject macro. The properties after the object may vary, but I believe you can always use something like EditedObject.GetValue("ColName")

0 votesVote for this answer Mark as a Correct answer

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