Available in: Axsy Mobile for Salesforce, Axsy Field Service, Axsy Public Sector, Axsy Retail Execution
Axsy Smart PDFs provide a way to dynamically generate richly formatted PDF documents within the Axsy Mobile App - even when offline. Making use of Smart PDFs involves the following three steps:
- Creating fillable PDF forms to be used as the templates for generated PDF documents.
- Uploading the fillable PDF forms to the Salesforce Platform.
- Creating Salesforce Screen Flows that make use of the Axsy Smart PDF Flow Component and reference the fillable PDF forms.
Creating a Fillable PDF Form Template
The basis for generating a PDF document within the Axsy Mobile App is a fillable PDF form which acts as a template. A fillable PDF form is a PDF document that includes editable input text fields. Creating a fillable PDF form template is done outside of the Salesforce Platform with your PDF editing application of choice. Depending on the chosen application, it should be possible to create fillable PDF forms from scratch or to modify an existing, static PDF document into one that has fillable elements.
Many free and paid applications are readily available for creating and editing fillable PDF forms, such as Adobe Acrobat (paid).
Input Text Fields
When creating the fillable PDF form template, input text fields can be added anywhere in the PDF document you want Axsy Smart PDFs to dynamically insert values at the moment of PDF generation. Each text fields needs to be given a unique and identifiable Name. It is important to take note of these text fields Names, as they will be used when creating the Salesforce Screen Flow, as described later in this article.
NOTE: The exact method of specifying the Name property when creating the fillable PDF form may differ depending on which PDF editing application is being used.
Signature Fields
In addition to inserting dynamic text, it is possible for Axsy Smart PDFs to insert captured signatures into the generated PDF document. Despite them being images instead of text, placement of captured signatures are also done by adding input text fields to the fillable PDF form template. However, input text fields that are meant to be replaced by captured signatures must have a Name which is postfixed with: .attachments[0].url
Example: If a part of the generated PDF is supposed to be filled with the customer's first name, last name and their signature, the fillable PDF form template could include the following three input text fields with names:
- CustomerFirstName
- CustomerLastName
- CustomerSignature.attachments[0].url
NOTE: For any input text fields that are to be replaced with signatures, it is best practice to make the dimensions of the text field have adequate height to accommodate the potential height of the captured signature.
Best Practice: Using Default Value
In addition to the mandatory Name property for each input text field, it is possible to specify a Default Value property. While including a Default Value is optional, it is a recommended to set a Default Value and have that value be identical to the Name property.
The reason behind this best practice is that some PDF viewing applications do not display the Name property for a text input field but will show the Default Value.
Example: When viewing a fillable PDF form with the Preview app for MacOS, it will show a text input field's Default Value but will not show its Name property.
NOTE: The exact method of specifying the Default Value property when creating the fillable PDF form may differ depending on which PDF editing application is being used.
Uploading the Form Template to Salesforce
Once the fillable PDF form template is ready, it needs to be uploaded to the Salesforce Platform as a file so it can be accessible by the Axsy Smart PDF Screen Flow.
Finding the Salesforce ID for the PDF File
Screen Flows that make use of Axsy Smart PDFs reference the uploaded template file via its Salesforce ID. Determining the Salesforce ID for a file on the platform can be done by viewing the File Details and then extracting the Salesforce ID from the resulting webpage's URL. The Salesforce ID is the string of characters that comes before the /view portion of the URL. See screenshots below.
Figure 1 - Select the option to "View File Details" to open the details page for the uploaded file.
Figure 2 - Viewing the File Details page
Figure 3- When viewing the File Details page, the Salesforce ID can be extracted from the webpage's URL
File Sync
The uploaded fillable PDF form needs to be synced to the Axsy Mobile App so it is available to be used as an Axsy Smart PDF template. Including the file in the Axsy Mobile App's sync scope can either be done by including it in a File Library that is configured to have its file content synced for offline access or by adding it to the Files Related List of a record that is included in the sync scope and that is configured to have its related file content synced for offline access.
For more information on including files in the sync configuration, please see these following articles: Configuring Files for Offline Sync and Configure the Related Object Tree
Creating a Screen Flow with the Axsy Smart PDF Component
Axsy Smart PDFs are essentially components that exist within a Salesforce Screen Flow. When the Axsy Smart PDF component is included in a Screen Flow, the input text fields in the associated fillable PDF form template will be replaced by the values of any linked Flow Variables and Flow Signature Capture Components. As this is done when the Screen Flow is run, and since Screen Flows can prompt the user for input as well as query Salesforce data, this allows the generated PDF document to include dynamic content.
Flow Variables and Signature Capture Components
Linking a Flow Variable to an input text field in the PDF template is done by matching an input text field's Name property to a Flow Variable's API Name. At PDF generation, the value for a Flow Variable will be used to set the corresponding input text field's value in the PDF.
NOTE: Enabling the Available for Output checkbox for the Flow Variable is not required.
Linking a captured signature in the Flow to an input text field in the PDF template is done by matching the input text field's Name property - excluding the .attachments[0].url postfix - with a Flow Signature Capture component's API Name. At PDF generation, the captured signature will be added as an image in the corresponding input text field in the PDF.
Please see the following article for more information on Flow Signature Capture: Flow Signature Capture
Configuring the Axsy Smart PDF Flow Component
PDF generation is triggered in a Screen Flow by including the Axsy Smart PDF component in the Screen Flow. This is done by drag-and-dropping the Smart PDF component onto a screen in the Flow.
Figure 4 - Adding the Smart PDF component to a screen of a Flow
Once added, the following parameters are available to be set for the Smart PDF component:
Parameter | Description |
---|---|
API Name | Unique API Name for the component in the Flow. |
Label | Label shown above the generated PDF preview when running the Flow. |
Template ID | The Salesforce ID for the fillable PDF form to be used as template. |
Description | Description associated to the generated PDF file if uploaded to Salesforce as a Content Document. Optional. |
File Name | File name for the generated PDF file if uploaded to Salesforce as a Content Document. File name extension, e.g. ".pdf", can be omitted. If this parameter isn't specified, the file name for the generated PDF will be set to the API Name. Optional. |
Related Record ID | If the generated PDF file is uploaded to Salesforce, you can have it associated with the Salesforce record specified here by its Salesforce ID. Optional. |
Should Upload? | If set to a value true, i.e. {!$GlobalConstant.True}, then the generated PDF file will be uploaded to Salesforce as a Content Document. Optional. |
Figure 5 - Smart PDF component parameters
Using Axsy Smart PDFs in the Mobile App
When running a Screen Flow in the Axsy Mobile App that includes Smart PDFs, the mobile app will dynamically generate the PDF document - even when offline - when it encounters the Axsy Smart PDF component. At that point, the app will display a preview image of the generated PDF document. Tapping-and-holding on the preview image will display the full PDF.
When viewing the PDF in fullscreen, it's possible to "Share" the file with other apps and functions on the user's device, based on what's supported natively by the user's device. Examples of sharing options can include printing the PDF, saving it locally to the device or sharing it with an email app for sending.
Figure 6 - Preview image of the PDF
Figure 7 - PDF fullscreen view with ability to "Share" with other apps/functions on the device
NOTE: If at the moment of PDF generation, it is determined that the template includes fields that have missing data, generation will still occur but a warning icon will be displayed that, when expanded, lists the data that was not provided as part of the Screen Flow.