Passing Query Parameters to Iframe from Mendix

0
    <iframe src="http://localhost:3000/d-solo/ffa0lqog0kw74e/new-dashboard?orgId=1&timezone=browser&refresh=5s&var-workcenter=Station1&panelId=1&__feature.dashboardSceneSolo" width="450" height="200" frameborder="0"></iframe>    URL-'http://localhost:3000/d-solo/ffa0lqog0kw74e/new-dashboard?' + 'orgId=1' + '&timezone=browser' + '&refresh=5s' + '&var-workcenter=' + urlEncode($Work_Center/Name) + '&var-line=' + urlEncode($Line/Name) + '&panelId=1' + '&__feature.dashboardSceneSolo'   Passing Query Parameters to Iframe from Mendix to display Machine Status Based on those Parameters(($Line/Name),($Work_Center/Name))
asked
5 answers
0

I was actually trying to explain this approach in my first comment as well, but I may not have explained it clearly enough.

 

When I try it in the way you can see in my screenshot, it works without any errors. However, when I implement it the way you did, I run into the error.

 

Screenshot 2026-01-17 at 12.27.41.png

answered
2

Another approach could be to use the HTML Element widget to inject the iFrame HTML directly into your page. 

 

https://docs.mendix.com/appstore/widgets/htmlelement/

 

You can define the iframe HTML, and then pass the src attribute as a parameter that you can generate it dynamically and pass in. This would need to be passed as an attribute in an entity used in a containing DataView.

 

Set the Content attribute to HTML and then edit the HTML. Similar to Ahmet's suggestion, set the Template to be

<iframe src="{1}" width="450" height="200" frameborder="0"></iframe>

You can now set the first parameter to be the URL of your iFrame.

 

HTML Element example iFrame

 

As an iFrame may be seen as unsafe, you also have to set the HTML Sanitization in the Advanced tab to allow the iFrame.

{
   "ALLOWED_TAGS": ["iframe"]
}

Screenshot 2026-01-15 at 21.05.29.png

 

I hope this helps. Good luck!

answered
0

One possible approach is to build the iframe URL as a String in Mendix (for example via a microflow or helper entity) and then render it using a Text widget with Render mode set to HTML. This allows you to dynamically inject query parameters using template expressions.

 

For example, you can construct the URL in a microflow and then use it in the Text widget like this:

<iframe src="[% URL %]" width="450" height="200" frameborder="0"></iframe>

Hopefully, this would work well for passing query parameters to an iframe in Mendix.

Have you tried this approach?

answered
0

You can also consider the IFrame Component from the Mendix Marketplace. It supports setting the iframe Src as an expression, so you can build the URL (including urlEncode() for parameters like Work_Center/Line) in Mendix and pass it directly to the widget.

answered
0

Microflow SUB_Generate_Grafana_URL

/file?guid=19703248381319729

image.png  

image.png

image.png

image.pngimage.png  image.png

 

I am getting this error.

answered