Pass Values to Send Fax Page with Custom Button
You can override and set default values of the fields on the Send Fax screen with a custom URL 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 sent fax record with merged data from a specific record and relate it to that record.
Create Button
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.
- 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 Contact object.
- Set Display Type to “Detail Page Button”.
- Set Behavior to “Display in existing window without sidebar”.
- Add your button code to the editor box.
- The Send Fax Lightning Component URL is: /lightning/cmp/efaxapp__SendFaxManually
- The url params should have “efaxapp” prefix, e.g., efaxapp__faxfield.
- The related fields like Account__c, Contact__c, Opportunity, Case__c… should be without the suffix “__c” (all fields in the Send Fax Custom Fields field set), e.g., Account__c should be efaxapp__Account. For more information about the Send Fax Custom fieldset, see “Modify Page Layouts” section of the Basic Configuration article.
- Add Button to base object’s page layout.
- Go to Setup>Object Manager.
- Select the object for your button.
- In the object’s menu on the left, select “Page Layout”.
- Select the page where you plan to add your button.
- In the object’s layout editor, select “Buttons” from the menu on the left side of the editor.
- Locate your new button, then drag it down to the “Customs Buttons” section of the object’s detail page layout.
- 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 NAME | DESCRIPTION |
efaxapp__faxfromnumber | This is the number assigned to your org. You will be sending the fax from this number. |
efaxapp__recipientid | This is the record that is related to the fax. For example, {!Contact}. |
efaxapp__faxtoobject | This 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”. |
efaxapp__faxtonumberfield | Expects 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”. |
efaxapp__faxtonumber | Expects a fax number value. This is the fax number where you will send the fax. |
efaxapp__coversheet | Possible 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. |
efaxapp__subject | Expects text in order to set a subject. |
efaxapp__comments | Expects text in order to set comments. |
efaxapp__fileid | 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. Supports ContentDocument, ContentVersion, Attachment and Document Ids. |
efaxapp__fileid2 | 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. Supports ContentDocument, ContentVersion, Attachment and Document Ids. |
efaxapp__fileid3…30 | If Coversheet=”None”, then this would be the value of the 3rd selected file through the 30th selected file. If Coversheet=”Standard”, “Custom”, or “External”, then this would be the value of the 2nd selected file through the 30th selected file. Supports ContentDocument, ContentVersion, Attachment and Document Ids. |
efaxapp__barcodepositionleft | Specifies the number of pixels from the left edge of the document in pixels. Expects an integer. |
efaxapp__barcodepositiontop | Specifies the number of pixels from the top edge of the document in pixels. Expects an integer. |
efaxapp__barcodesizewidth | Width 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. | |
efaxapp__retURL | By 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 Fields | You 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 efaxapp__barcodepositionleft, efaxapp__barcodepositiontop, and efaxapp__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.
/lightning/cmp/efaxapp__SendFaxManually ?efaxapp__faxfromnumber= &efaxapp__Account= &efaxapp__Contact= &efaxapp__Opportunity= &efaxapp__faxtoobject= &efaxapp__faxfield= &efaxapp__faxtonumber= &efaxapp__barcodepositionleft= &efaxapp__barcodepositiontop= &efaxapp__barcodesizewidth= &efaxapp__retURL= &efaxapp__cover_sheet= &efaxapp__fileid= &efaxapp__fileid2= &efaxapp__fileid3= &efaxapp__fileid4= &efaxapp__fileid5= &efaxapp__fileid6= &efaxapp__fileid7= &efaxapp__fileid8= &efaxapp__fileid9= &efaxapp__fileid10= &efaxapp__comments= &efaxapp__subject= |
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, populates the Account lookup, and adds one barcode to the Sent Fax Preview. The user will manually select which file(s) to fax from the Contact Related Files, Account Related Files, Other Related Files, or upload files from their computer. They can also adjust the placement of the barcode.
/lightning/cmp/efaxapp__SendFaxManually ?efaxapp__faxfromnumber=8004446666 &efaxapp__Account={!Account.Id} &efaxapp__faxtoobject=efaxapp__Contact__c &efaxapp__faxfield=Fax &efaxapp__faxtonumber={!Contact.Fax} &efaxapp__barcodepositionleft=100 &efaxapp__barcodepositiontop=70 &efaxapp__barcodesizewidth=50 &efaxapp__retURL={!Contact.Id} &efaxapp__cover_sheet=Standard &efaxapp__comments=Test Comment &efaxapp__subject=Test Subject |
Example Button – Multiple Barcodes
This button is the same as above, with one exception: it adds three barcodes instead of one.
/lightning/cmp/efaxapp__SendFaxManually
?efaxapp__faxfromnumber=8004446666
&efaxapp__Account={!Account.Id}
&efaxapp__faxtoobject=efaxapp__Contact__c
&efaxapp__faxfield=Fax
&efaxapp__faxtonumber={!Contact.Fax}
&efaxapp__barcodepositionleft=100, 60, 45
&efaxapp__barcodepositiontop=70, 22, 34
&efaxapp__barcodesizewidth=50, 78, 98
&efaxapp__retURL={!Contact.Id}
&efaxapp__cover_sheet=Standard
&efaxapp__comments=Test Comment
&efaxapp__subject=Test Subject