How to get all custom properties of a component, window, etc?

I’m working on troubleshooting something and I thought it’d be pretty cool to get all custom properties of all windows open, maybe go deeper to templates/template properties, etc so I can poll them periodically and get their values. Any way to do this easily?

Also while I’m at it, any way to get the binding for a given property?

Thanks!

EDIT: Looks like I should have done some more research before posting - looks like .getProperties() will do for the basic things I want, though I’d still like to know if someone can tell me how to get the actual binding information (like expression text, sql text, etc).

Start here, look at the getInteractionController() method, and continue down the rabbit hole. (-:
You should note that bindings are not part of the component, but are part of the window. For generic components, they are established on window open. For template elements, they are created and destroyed as templates are selected and deselected in the various holders. (But still as objects of the window.)
Also note that while documented for module developers, these APIs are very much not supported nor guaranteed to hang around.

Ah, that is quite the rabbit hole! Very cool stuff, definitely going to be diving into it more!

Hi, @mrogers.

How can I access the .getProperties() method you mentioned?

I’m looking at only getting the Custom Properties from one window and passing them as params to another window.

There might be a better way to do this, but by messing around I found that I could create a parameters dictionary from a window with the following code:

# Initialize variables.
root_container = event.source.parent

# Initialize dictionary.
parameters = {}

properties = root_container.getProperties().tolist()

for property in properties:
	parameters[str(property)] = root_container.getPropertyValue(str(property))

print parameters

As I say, there might be a better way to do this. If there is, please share your solution.

2 Likes