Hi Tang,
I know it is old question but in case someone looks for this in the future here is an answer(tested on 9.5.1). As Narayana said you can use your custom java action for that. The method Core.retrieveId(getContext(), id) will get you what you need but you need to provide IMendixIdentifier. Find below a code snippet and screenshots which will help you achieve what you need.
// BEGIN USER CODE
try{
IMendixIdentifier ident = Core.createMendixIdentifier(this.ObjectId);
IMendixObject recivedObject = Core.retrieveId(getContext(), ident);
return recivedObject;
}catch(Exception e){
return Core.instantiate(getContext(),Entity);
}
// END USER CODE
Hope this helps.
Hi tangd,
There is a function which returns a list of mendixObject or a single object
you can use this in java action
List<IMendixObject> objectlist = Core.retrieveIdList(getContext(), ids);
IMendixObject myobject = Core.retrieveId(getContext(), id)
you may want to create your own id for that (auto number is probably the easiest solution)
There is a difference between a database-id of an object and an object’s id that is used in the real world. Mendix shields away the object’s ids because it is (mainly) for internal use and prevents the common mistake of using the id as a public id of an object. That being said, you probably have a valid usecase, so here is what you can do:
First in your microflow add a Java-action ‘getGUID’, like I do here for my Email-object:
then you can use the ReturnValueName to compare it to the object’s id.