How can I get/find a Unique Client ID in Nanoflow

0
HI All,   I need to use a unique identifier for the Client that is trying to connect to a Hybrid app (Phone Web Offline). I can’t use the currentSession object, as I need to find this unique ID from a Nanoflow.   Do you know how get/find this information?   Thank you
asked
1 answers
0

Seems like this resource might have your answer:

https://stephanbruijnis.dev/posts/native-get-guid/

 

 

2. Created on Native, synchronized with server

After synchronizing the objects created with the server, the object now has a GUID generated by the database as well. This information is also synchronized to the device. However when you call the GetGuid JavaScript action you will still get the Native object identifier, not the server GUID. Why? It appears that Mendix keeps returning the Native GUIDs until the app restarts. 2

The object GUID would be the perfect candidate to pass as Microflow parameter — since its not not allowed3 to have a persistable entity as Microflow parameter when the Microflow is called through a Native Nanoflow —if it weren’t for the behaviour described above: you still get the Native GUID, even when the object has been synchronized. This can’t be used to retrieve the object server-side (in the Microflow).

Workaround: perform a before commit event on the entity. The before commit event will retrieve the GUID (JavaAction) for the object and store it on a separate attribute (e.g. _GUID) on the entity. This attribute will be safe to use as a parameter in Microflows called from native Nanoflow, as the before commit action (all entity event handlers) are only executed on the server4 —and thus will set the correct GUID5— and you can check if this attribute has a value before calling the Microflow.

answered