Changing the Default Form Window Size

Paul Nieuwelaar, 09 June 2010

By default in CRM when you open up a Lead, Contact, Account or any other form for that matter, the dimensions of the windows are 1012 pixels wide, by 611 pixels high, and the position of the window is 124 pixels in from the left of the screen, and 170 pixels down from the top of the screen. These pre-set dimensions work fine until you have too many fields to fit on the tab, and the annoying vertical scroll bar appears.

Instead of moving important fields to another tab, or forcing yourself to live with the vertical scroll bar, you can add a little bit of JavaScript to the forms OnLoad event to overwrite the default dimensions of the window.

  1. Navigate to Settings, Customization, Customize Entities and then locate and open the entity you wish to change the dimensions of.
    For this blog I will be changing the dimensions of the Contact form.
  2. Click on Forms and Views and open up the main Form view.
  3. Click on Form Properties, select OnLoad, and then click Edit.
  4. Make sure the Event is enabled check box is checked, and then paste in the following code into the OnLoad event.

    window.resizeTo(1012,611);
  5. Change the numbers above to alter the size of the window. Where 1012 is the default width, and 611 is the default height.
  6. After changing the height and width of the window you may find that the positioning of the window now needs changing as well. To change the positioning of the window paste the following code below the last line of code in the OnChange event.

    window.moveTo(124,170);
  7. Change the numbers above to alter the positioning of the window. Where 124 is the default distance between the window and the left of the screen, and 170 is the default distance between the window and the top of the screen. It should look something like this:
  8. Click OK twice to close the OnLoad event, and Form Properties windows.
  9. Save and Close the Form, and then Publish your changes.
    NOTE: If you Preview the Create Form the positioning of the window will be different to the positioning of the actual window when published. So it is best to publish it and check the changes properly.

If the dimensions aren’t exactly right you can just open the OnChange event again and modify the dimensions until it looks how you want it.

When the window is opening your changed dimensions won’t take effect until it has fully loaded the window, so while you’re trying to get the dimensions exact you can compare the window sizes and positions to make sure they are exactly what you require.

In the image below the Contact form is customized to 1000px wide by 500px high, and the position of the window is 100px from the top and left of the page.