How do I retrieve a TrackObject?

Hello!   I am trying to use getTrackObject() (MxContext namespace) on an mxcontext object and am getting a null. In the screenshot below, you can see the mxcontext object itself is not null. However: it appears that the trackObject is null (red arrow), yet when I open the Object, I can see that it does have a trackObject (black arrow). I am trying to access this using an HTMLSnippet with Context. This is what I have that logs the object in the screenshot above: var context = this.mxcontext; console.log(context); But then this will log a ‘null’: var mendixObj = context.getTrackObject(); console.log(mendixObj); How do I access the track object (black arrow)?  
1 answers

Hello Sharon,

I tried to reproduce your use case and I think you are logging the TrackObject to soon, before it’s actually initialized on the page. When you turn on the settings “refresh on context change” and “refresh on context update” you will see that the TrackObject is logged by using your code.


See screenshots.

kind regards,