Expose GUID in the Modeler - Mendix Forum

Expose GUID in the Modeler


While working with the Mendix js and java APIs I found GUIDs to be extremely useful and found it very odd that GUIDs cannot be used in the actual modeler.

I think being able to retrieve objects via GUIDs, get an object’s GUID and expose GUIDs in tables/fields would come in very handy, at the very least to accomplish the follwing:

  1. To expose a unique identifier to an app user without having to create another GUID and manage it. 

Users often want something that is very similar to the GUID and exposing it would solve some requirements.

  1. To generalise microflows.

As we cannot use a generalised Mx object in the modeler, the GUID would be a way around generalisations. For example this could be used in a generic email generation microflow where your inputs would be the Email template and the Object GUID.

  1. To perform optimal retrieves

Since the GUID is a PK in the database (and inherently indexed) being able to use it throughout would make queries faster. For example when using a deeplink passing a GUID and doing the retrieve on GUID would enable a faster query.

2 answers

Hey Chris – you’re right about obtaining the GUID, but that includes an overhead of running the Java action. Furthermore there’s no way, as far as I’m aware to do a retrieval based on a non-static GUID. 

“[id = $myVar]” triggers errors regardless of whether $myVar is a string or an integer. You’d need to have an actual entity or entity association to be able to run the id= xpath which doesn’t create the same effect.


Dragos – what you say is true.  Are you aware that you can access the GUID via Community Commons java actions (ORM.getGUID) and then to retrieve you can reference it in XPath