How to get a context of data view?

0
Hi Team.   I have used hTMLSnippetWithContext widget and placed into the inside the data view which I want GUID for that object. Mendix version is 8.9.0 and have referred below documents. Mendix 8 Client Documentation: Class: mendix/lib/MxContext Mendix 8 Client Documentation: Class: mendix/lib/MxObject   I have used below piece of code into inside the htmlsnippet widget. $(function() { var context= this; var mxObj = context.getTrackId(); //Gives GUID of respective context console.log(mxObj); });       While try to running after having above piece of code and getting below error in the console.     Kindly provide a solution on the issue.   Thanks in advance.  
asked
1 answers
1

Hello Dinesh,

 

I reproduced your use case in Mendix 9.17. To be able to get the correct ID you have to turn on the “refresh on context” settings otherwise you will log the ID before the object is initialized,

 

Hope this helps also for you in Mendix 8.

 

See screenshot:

answered