function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
aruna11.3081223889641084E12aruna11.3081223889641084E12 

How to customize the size of window for opening Visualforce page?

Hi,

 

I need to open a visualforce page from the formula link...

So, in hyperlink function i have set the url for opeing that VF page.

Just the simple hyperlink formula:

 

HYPERLINK("/apex/TestPage", Email)

 

Now, i want t open this "Testpage" in new window with fixed height and width.

 

From standard config  setting for the detail page button, i am able to provide height and width for the new window.

But how to provide height and width through this formula field?

 

Please help!!

 

Best Answer chosen by Admin (Salesforce Developers) 
aruna11.3081223889641084E12aruna11.3081223889641084E12

Hey Guys,

 

Finally comes the solution for the same:

 

I have used formula field to redirect to VF page and setting the height and width while loading the window as below:

 

Formula field:

HYPERLINK("/apex/TestPage", Email)

 

VF resized window script:

<html>
<head>
</head>
<body onload="moveTo(0,0); resizeTo(400,300);">

hello

</body>
</html>

This is the required solution and finally got it...

 

Yippppppppeeeeeee..  :)

 

All Answers

bob_buzzardbob_buzzard

I don't think you'll be able to do this.  The HYPERLINK function generates a URL, but you can't set size information via a URL, you need to use javascript instead.  

aruna11.3081223889641084E12aruna11.3081223889641084E12

Thanks for the reply Bob.

 

Yes, we cannot set width and height of the window in Hyperlink function.

 

The other way is to use window.open function, but not sure how to use this in formula with the window height and width attributes..

 

Help will be greatly appreciated..!!

bob_buzzardbob_buzzard

I don't think that you'll be able to put javascript in a formula field and use it on the page.  Is this something that appears on a standard record view page and opens a visualforce window?

aruna11.3081223889641084E12aruna11.3081223889641084E12

Yes, this will be the formula field to one email field in standdard detail layout.

On clickikng that field value, VF should be opened in new window with fixed size.

 

 

nasknask

Hi Aruna,

 

I am not sure if this would help, you can open a vf page on click of that link and write javascript in page to resize it. I am not sure but we can give a try ? 

 

Ashok

aruna11.3081223889641084E12aruna11.3081223889641084E12

Hey Guys,

 

Finally comes the solution for the same:

 

I have used formula field to redirect to VF page and setting the height and width while loading the window as below:

 

Formula field:

HYPERLINK("/apex/TestPage", Email)

 

VF resized window script:

<html>
<head>
</head>
<body onload="moveTo(0,0); resizeTo(400,300);">

hello

</body>
</html>

This is the required solution and finally got it...

 

Yippppppppeeeeeee..  :)

 

This was selected as the best answer