Retrieve object dynamically (by path)

Hello! I'm using the ModelReflection module. In my application, in a module i'm working with a template entity (MessageTemplate). Each MessageTemplate is related to one entity, selected via ModelReflection. So, one related MxObjectType. Second, I can add multiple tokens to a MessageTemplate. These are attributes of the related entity. In my template, I'm using the different tokens such as {%FirstName%} etc.   Now I want to create a Message based on the MessageTemplate. By creating the message, I would like to replace all the tokens for the related attribute. I can search for the token and replace the text by using replaceAll(). However, I would like to find dynamically the related attribute. So sort of retrieve a object, by a dynamic path. I can create the path by combining the MxObjectType and the MxToken, but I'm curious how to get the related object from the database.   Thanks in advance.
1 answers

I guess your object is associated with an object that is available in your microflow/JavaAction. If you retrieve by using an xpath and compare the path to your reference object, you will get the same result as if you do an xpath retrieve in the microflow. Since it’s a database retrieve, it will return a list. But if you are sure that you only get a single object, you can just work with the first from the list.
I don’t know if this answers your question entirely. I hope it helps.