[SalesForce] Trying to pass Account Name into a Visualforce iframe URL

I'm trying to embed a visualization/chart from an external SQL tool via a VisualForce iframe section on the Salesforce Account page layout. To do this, I need to append the account name into the SQL report URL.

I've managed to get the VisualForce page setup to display the visualization/chart properly, but I'm having trouble with my Controller to have it pull the Account Name of the current account page.

Any help to get this working would be greatly appreciated.

<apex:page standardController="Account">
<iframe src="https://modeanalytics.com/reports/bca8c3be75b6/runs/be5b8b8f62c0/?run=now&param_domain={!Account.Name}" width="100%" height="400" frameborder="0"></iframe>
</apex:page>

Best Answer

Apart from the addition of URLENCODE to handle cases where the Account name included e.g. spaces:

<apex:page standardController="Account">
<iframe src="https://modeanalytics.com/reports/bca8c3be75b6/runs/be5b8b8f62c0/?run=now&param_domain={! URLENCODE(Account.Name) }" width="100%" height="400" frameborder="0"></iframe>
</apex:page>

as martin pointed out you do need to supply an Account ID as otherwise the standard controller thinks it is working on a new Account that doesn't have an ID or name. So the request URL needs to be of this form:

/apex/YourPageName?id=001i000000UBpmI

where 001i000000UBpmI is an existing Account ID. This will successfully add the Account name to the iframe URL.