ReplaceToken from the MxModelReflection Module behaving weird

Hello guys   I am using the ReplaceToken Java action from the MxModelReflection Module. The Value object dosent allow me to use the MxModelReflector Object Type for the Member. When I use the actual Entity Object of the target Member it works fine (e.g. $Project).     Not working, but should in my opinion: $IteratorToken/MxModelReflection.Token_MxObjectMember/MxModelReflection.MxObjectMember/MxModelReflection.MxObjectMember_MxObjectType/MxModelReflection.MxObjectType   What is the point of the TokenReplacement function if I cant use it generically with the Reflection model? Would need to add 20 conditions with different entity types otherwise.   Would love to know if this is by default, or a bug.   Thanks. Ron  
2 answers

I think you are using it wrong. Let's say you have an Employee entity with the atribute fullname.  So you create a token for that Employee object {%FullName%} . In the Java action you pass this to the first field Token object. Then you pass the employee object where you want the full name of as the Value object. And in the third line you pass your text containing the token (so for instance Dear {%FullName%}). The text you now get back from this Java action is Dear Ronald Catersels (if I was the employee).

So this way you can do token replacement from every entity and attribute in your model.
And imho Mendix could improve on this Java action. It would have been better if a list of tokens could be passed so that multiple tokens in the text could be replaced all at once. For examples check out the email template or the email connector module for some examples on how to do that. But such a Java action should be in the model reflection in my opinion.




Thanks for the answer. I think that is what I was looking for and havent found it. In that case you are right, Mendix should provide an additional action. That would save us of having to use the ReplaceToken action for each entity we used in MxModelReflector. It would get the other entities bases on the Xpath of the Token.