[SalesForce] Visualforce Page: include Page with changed Parameters

I have a VF Page referencing a VF Component to display a PDF attached to a Record. Both Page and Component are part of a managed package. The Page is included in the standard layout of the record to display the PDF there.

The Problem is the PDF Height in the standard layout is too small. I want to increase the Height so it is easier to read.

The VF Component gets the height as a parameter called "max" from the Page. Sadly the component is not global so i can't make a custom page referencing the component. Instead my approach was creating a custom page, including the managed page and change the Parameter there.

This would be my Custom Page:

    <apex:page standardController="myObject__c" showHeader="false" sidebar="false">
        <apex:iframe src="/apex/myManagedPage?id={!myObject__c.Id}&max=1000"/>
    </page>

And this is the Managed Page:

<apex:page standardController="myObject__c" showHeader="false" sidebar="false">
    <c:myManagedComponent objectId="{!myObject__c.id}" maxHeight="{! IF(!isBlank($CurrentPage.parameters.max),$CurrentPage.parameters.max,'500')}"/>   
</apex:page>

Thanks in advance.

Best Answer

You can pass the parameters you desired with iframe via source attribute.

I can help you to do that if this solution is ok for your case.

        <apex:iframe src="yourDomain/apex/YourPagename?max=2000" />

This will execute your other pages's controller and pass parameter(s) to your component. But it will behave as a different page on the same screen.

For further information https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_iframe.htm

Can you also write your use case so maybe I can suggest you a better solution.

Related Topic