[SalesForce] how to control the height of a visualforce lightning action

We're checking the feasibility to roll out lightning experience to our users.

We had a couple of layouts where we had inline visualforce pages.
Since lightning experience changes the mindset of focusing more on actions rather then looking at the detailed fields of records, I would like to offer these inline pages in another way.

My first idea was to make them available to the users through a custom visualforce action.

Even though on the action, it let's you specify the height, it doesn't seem to take the height into account… and it also doesn't size the modal window opened based on the content that is in the modal. (my VF page)

Any way to fix that? Or advise to do it another way?

Best Answer

Copying my answer from the Success community.

Since publisher actions use Canvas, you can resize the iframe from inside of your Visualforce page by including publisher.js and calling Sfdc.canvas.publisher.resize. You'll also need to set html-style="height: 100%" on your Visualforce page. You may want to utilize {!$User.UITheme} to only do this resizing inside of Lightning experience.

Example Code:

<apex:page showHeader="false" sidebar="false" standardController="Lead" html-style="height: 100%"/>
  <script src="/canvas/sdk/js/publisher.js"/>

  <script>
    Sfdc.canvas.publisher.resize( { height : "400px" } );
  </script>
</apex:page>
Related Topic