Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Acessing text object in master page


Level 6


I have two master pages in my form. The first one is being used but not the second one. In the second one, I have a text object. Using javascript at design time Im able to get the som expression to that text object, so it really exists in my form.

However, at run time I get a null value when getting the object. I believe this is due to the fact that the second master page was not instantiated, because I didnt associate it with any form.

so my question is: is it possible to access objects in a master page that was not associated with a form? Can I initialize it programmaticaly or something like that? I want it to exist in the form, but not to show it associated with a form.

thank you,


2 Replies


Level 9


I guess it would be a difficult thing to do. How about making a page as hidden and access it when required instead of going for a master page and not using it.




Level 8

You're right, if your masterpage isn't instantiated, then there is no instance of it in the form object model and therefore cannot be accessed via the absolute SOM expression that Designer gave you when Ctrl-clicking the object. You have to access the template object model (the design-time model I like to call it).

You can use the following to access your object:

xfa.resolveNode("template.form1.pageSet.Page2.yourObject") //notice template instead of form

This is assuming your root node of form1 and your hidden masterpage name is Page2. Keep in mind you can only read the properties of the object, you can't manipulate them.

I'm not sure why you'd need to access an object that isn't instantiated yet, so I'd agree with Bibhu's solution.