Not sure if this is the right place to ask for this feature, but it would be great if we could use entity data with javascript/html in the html snippet contents property. This way we could use the code contextually.
If you click the link below, there's a button " New Issue" to the right. Click it and voila :-)
Rik's idea works aswell, but it requires you to dive in to the JavaScript yourself. It is the fastest way however, since I'm not sure when your feature request would be picked up by Mendix.
https://github.com/mendix/HTMLSnippet/issues
//edit: I see you did manage :)
You may use:
// Get the context of the HTMLsnippet Widget.
var context = this.mxcontext
// Get the MxObject of the context
var contextObj = context.getTrackObject();
This will give you the MxObject if available: https://apidocs.mendix.com/6/client/mendix_lib_MxObject.html.
The latest version of the widget allows you to do an update on refresh / reload of the object. However, I would really recommend you to write your own widget if you need entity specific logic.
See: https://github.com/mendix/generator-mendix, https://github.com/mendix/AppStoreWidgetBoilerplate and https://world.mendix.com/display/refguide6/XML+Reference+Guide for more details on how to do this.
Thanks Paul. I already tried it but I couldn't find anywhere to do it.