How to fetch the context of the HTML Snippet with context

0
      We open a page with a context parameter, and have the HTMLSnippetWithContext inside a dataview. We have placed the following code inside the HTMLSnippetWithContext widget contents box   try{ if(this.contextObj!=null){ console.log("IT IS NOT NULL"); }else{ console.log("IT IS NULL"); } }catch(e){}   The result in the console is "IT IS NULL".  What could we do to fetch the context inside the JavaScript and work with it inside the custom JavaScript code? 
asked
2 answers
1

https://forum.mendix.com/link/ideas/117

answered
1

You can use the mendix client api’s to retrieve the current object from the context.

var obj = context.getTrackObject();
obj.getGuid();  // "12345"
obj.get("attributeName"); // returns the value of the attribute

More information about the context in a widget can be found in the docs:

Link

answered