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.

Help constructing SOM Expression


Former Community Member

I've puzzled over this for many hours and decided I definitely am a fish out of whater. Could you please help?

My problem: I need a way to substitue a string for the SOM Expression of certain fields without always having to write out the whole expression. Basically, I am trying to figure out if I know the location, can I pass a variable with that location's string into a function, and then have the function process several instructions, using the passed string as the SOM Expression?

For example, if the SOM Expression for 2 fields are:



If I know the string which is the exact location of FieldA and FieldB, can I somehow pass those strings into a script object so the same function can work with multiple fields. E.g. if I wanted to change the font size, bold the font, and font color of each field, could I pass the string of the SOM Expression into a script object method which would process these 3 properties, and then pass the string for the second field's location into the same function to process that field? The reason I want to do this is my form has about 50 such fields which have about 15 processes which are used for each form.

I'm sorry if this isn't clear. I'd really appreciate any help someone might have to offer.


2 Replies


Former Community Member
You can pass the object itself by using the somExpression. You do not need to pass a string in. So calling the script would be:


and in ths script object to recieve the object you would use:

var myObj = Form1.Subform1.FieldA.nodes

Or you can pass subform nodes and search the subform for fields. if you post your email I will send you a sample that shows how.


Former Community Member

Thank you very much for helping me. I'll give it a try.

I would appreciate a sample. My email address is leedoc3AAA-bookit@yahoo.com minus the letters "AAA".

Again, thank you.