Skip to content Skip to main navigation Skip to footer

Pass Values to Send Fax Page with Custom Button

To send a fax manually, you would either go to the Send Fax tab or click the “Send Fax” button under the related object’s “Sent Fax” related list. Alternatively, You can override and set default values of the fields on the Send Fax screen with a custom button. This may save you a few clicks so you don’t have to manually enter values for fields on the Sent Fax record. Configuring a custom button allows you to quickly create a New Fax record with merged data from a specific record and relate it to that record.

For example, to create a custom button on the Contact object that would always set specific field values when faxing, you would configure the button as follows.

Get Send Fax Tab URL

  1. Switch to Classic.
  2. Click Send Fax tab. You should be able to see a URL in the following format (where “tabName” equals the unique ID for your org): https://efaxapp.na30.visual.force.com/apex/SendFaxManually?sfdc.tabName=01r36000000Q7FF
  3. Copy this URL  to clipboard.
  4. Go to Setup and create a new Button on the base object the object from which you’d like to send the faxes. For this example, we would go to Contacts.
  5. Set Display Type to “Detail Page Button”
  6. Set Behavior to “Display in existing window without sidebar”.
  7. Paste the URL from clipboard into the button edit area.
  8. Modify the button by adding variables to the URL for fields. How you choose to configure your button is determined by your organization’s needs, Salesforce org, and business processes. The button will be a url type and will link to “/apex/efaxapp__SendFaxManually” which is a visualforce page included with the app package. You can add url variables to pre-populate the fields on that page. To add variables, add “?” after the initial url and then “&” in between each additional variable.

Add Button to Object’s Page Layout

In order to see the button, you’ll need to add it to the page layout.

  1. Go to Setup>Object Manager.
  2. Select the object for your button.
  3. In the object’s menu on the left, select “Page Layout”.
  4. Select the page where you plan to add your button.
  5. In the object’s layout editor, select “Buttons” from the menu on the left side of the editor.
  6. Locate your new button, then drag it down to the “Customs Buttons” section of the object’s Detail page layout.
  7. Click “Save”.

Overview of Button Variables

Listed below is an overview of variables that you could choose to put in your button code. All variables are optional and the order that you list the variables does not affect functionality.

FIELD NAMEDESCRIPTION
faxfromnumberThis is the number assigned to your org. You will be sending the fax from this number.
recipientidThis is the record that is related to the fax. For example, {!Contact}.
faxtoobjectThis is the base object of the record that is related to the fax. Expects the label name of the lookup field on the Sent Fax object. Indicates which lookup to use to get the related fax number field. For example, “Contact”.
faxtonumberfieldExpects API name of a phone type field on the related lookup object. For example, if you are faxing to a Contact and the field on Contact is called “Company_Fax__c” you would put “Company_Fax__c”.
faxtonumberExpects a fax number value. This is the fax number where you will send the fax.
CoversheetPossible values are “None”, “Standard”, “External”, or the Document Action ID of the Document Action for a custom cover sheet template configured with Opero Documents. For example, if you have configured a Document Action for a cover sheet template based on the Sent Fax object and the Action ID is “GDT-000015”, that would be the value to merge.
SubjectExpects text in order to set a subject.
CommentsExpects text in order to set comments.
fileidExpects a Salesforce Id of a File.
If Coversheet=”None”, then this would be the value of the first file selected.
If Coversheet=”Standard”, “Custom”, or “External”, then leave this blank for the cover sheet.
fileid2Expects a Salesforce Id of a File to add in second position.
If Coversheet=”None”, then this would be the value of the second file selected.
If Coversheet=”Standard”, “Custom”, or “External”, then this would be the value of the first file selected.
fileid3…fileid10Expects a Salesforce Id of a File to add in third thru tenth position.
If Coversheet=”None”, then this would be the value of the third thru tenth file selected.
If Coversheet=”Standard”, “Custom”, or “External”, then this would be the value of the second thru ninth file selected.
barcodepositionleftSpecifies the number of pixels from the left edge of the document in pixels. Expects an integer.
barcodepositiontopSpecifies the number of pixels from the top edge of the document in pixels. Expects an integer.
barcodesizewidthWidth of the barcode, in pixels. Expects an integer.
Best practice to determine barcode position values would be to first create a Sent Fax record manually, send it, and then look at the Sent Fax record to see the values of these three fields. You can copy the values and set them in your button code in order to ensure your preferred barcode position each time.
retURLBy default, the app will redirect to the new Sent Fax record after sending the fax or clicking “Cancel”. If desired, set this value to a Salesforce Id of a record you want to return to. Common use case would be to return to the original related record where you clicked the custom button, such as {!Account.Id}.
Additional Lookups and Custom FieldsYou can set any other lookup fields included with the app, any custom lookups, or any custom fields on the Sent Fax object.

How to Add Multiple Barcodes in Your Button Code

If you’d like to add more than one barcode parameter with your button, specify another barcode parameter after the previous value separated by a comma, e.g. barcodepositionleft=100, 70. Add up to 15 values. Note that the barcodepositionleft, barcodepositiontop, and barcodepositionwidth should all have the same number of values.

Button Code

Listed below is button code with variables listed without any values. You can easily copy & paste the blank code to start with, then fill in values after the = sign on each variable that you wish to populate. All variables are optional. And you can leave the variables in your url without any value after the = sign without any issues to leave there for later if you want to populate them.


/apex/efaxapp__SendFaxManually
?faxfromnumber=
&recipientid=
&faxtoobject=
&faxtonumberfield=
&faxtonumber=
&coversheet=
&subject=
&comments=
&fileid=
&fileid2=
&fileid3=
&fileid4=
&fileid5=
&fileid6=
&fileid7=
&fileid8=
&fileid9=
&fileid10=
&barcodepositionleft=
&barcodepositiontop=
&barcodesizewidth=
&retURL=

Example Button – One Barcode

You can relate a Sent Fax record to any standard or custom object. This example button relates a Sent Fax record to a Contact record.


/apex/efaxapp__SendFaxManually
?faxfromnumber=6193747158
&recipientid={!Contact.Id}
&faxtoobject=Contact
&faxtonumberfield=Fax
&faxtonumber=
&coversheet=Standard
&subject=testsubject
&comments=testcomments
&fileid=
&fileid2=0695e000004rl6hAAA
&fileid3=
&fileid4=
&fileid5=
&fileid6=
&fileid7=
&fileid8=
&fileid9=
&fileid10=
&barcodepositionleft=100
&barcodepositiontop=70
&barcodesizewidth=50
&retURL={!Contact.Id}

Example Button – Multiple Barcodes

This button is the same as above, with one exception: it adds three barcodes instead of one.

/apex/efaxapp__SendFaxManually
?faxfromnumber=6193747158
&recipientid={!Contact.Id}
&faxtoobject=Contact
&faxtonumberfield=Fax
&faxtonumber=
&coversheet=Standard
&subject=testsubject
&comments=testcomments
&fileid=
&fileid2=0695e000004rl6hAAA
&fileid3=
&fileid4=
&fileid5=
&fileid6=
&fileid7=
&fileid8=
&fileid9=
&fileid10=
&barcodepositionleft=40, 413, 229
&barcodepositiontop=30, 30, 562
&barcodesizewidth=40, 40, 56
&retURL={!Contact.Id}