In this article I would like to consider 3 examples of adding a custom print button to a system screen.
The button to be added will open a new version of the current screen that has minimal formatting which will allow the relevant information on the screen to be printed. The screen that will be used for these examples is the Quote Summary page.
and the version for printing will look like this
These three techniques are
- The simple crm.addButton("print") method
- A combination of the API methods with Button Groups.
- Using the API for fine control of button positioning.
The simple crm.addButton("print") method
This is a very simple 'solution' and allows a print button to be added to the page. The code needs to be added to the Custom Content box of the QuoteSummary screen.
You can see from the screen below that this adds the button onto the screen but it does so below the Help button. Although the behaviour is correct there is no positioning information.
A combination of the API methods with Button Groups.
The appearance of the button within the page can be improved by adding the button using the Button Groups technique.
The general idea of this has been discussed in the article "Adding a Print Button to a System Screen".
To do this we need to set up a Button Group for a screen like the QuoteSummary system action.
Administration -> Advanced Customization -> Button Groups
The print button can be created by adding a option using the settings
- Caption: Print
- Action: customurl
- Bitmap: print.gif
Note: The advantage about this technique is that the button is placed correctly above the Help button and the SQL clause of the tab option allows further control of when the button should be displayed. The disadvantage is that the order of the button can only be controlled within the group of buttons added using the Button Group.
Using the API for fine control of button positioning.
The greatest control of a new button is provided by passing an options object into the 4th parameter of the Client Side crm.addButton() method.
The property 'index' is used to within the option object to allow the button to be positioned exactly where it is needed within the existing set of buttons.
The code that produced this button can be added into the Custom Content box of the QuoteSummary screen.