Before getting started, make sure you have the following items at the ready:
Printing PDFs are recommended when:
Otherwise, it may be worth checking out raw printing. If you're unsure, reach out us for help.
In this example flow we will enable a user to select and print a PDF associated with an Account object. This can be done for any standard or custom object.
Depicted below is the final result. This solution enables the user to rapidly select and print a related PDF right from Salesforce Mobile. This flow can be adapted to support nearly any use case.
Set API Name to recordId.
Set Description to This is the id of the record passed in.
Set Data Type to Text.
Check Available for input.
Click Done.
AND(
NOT(ISBLANK({!recordId})),
OR(
LEN({!recordId})=18,
LEN({!recordId})=15
)
)
API Name: The API name of the component. This can follow any naming convention you prefer.
Auto Print on Open: This determines whether or not the print triggers immediately once the user arrives at this screen. We recommend setting this to {!$GlobalConstant.True} to ensure it print immediately without requiring the user to tap a print button once more to confirm. Otherwise, setting this to {!$GlobalConstant.False} will render a button for the user to print.
Button Label: If the previous field was set to {!$GlobalConstant.False}, this field determines the label of the button text that the user will see on their screen.
Button Style: This determines the style of the button. We default to brand which is just the generic brand color in your org (often blue). Options include: success, text-destructive, destructive, outline-brand, brand, and neutral. More details can be found here.
Copies: This number determines the number of copies to be printed. If you plan to utilize copies, we recommend you read this guide for handling copies.
Type: This field tells the app if the type of printing if pdf or raw. Since this is PDF printing the value for this field should be PDF. For raw printing it would be set to RAW.
PDF Record ID: This is for the contend document record Id. This tells the package which content document should be sent for printing. We will input the selection that the use made in the data table here.
PDF Scale Mode: This tells the app whether a PDF should FIT to the media (scale automatically up or down to fit) or print exact size ACTUAL (potentially having content spill off the media). A value of FIT ensures the content scales to fit while a value of ACTUAL prints the actual size. In the case of raw printing, this field is not relevant. For this example we will put FIT.
Raw Body: This is the raw content or in this case ZPL that is being sent to be printed. When printing a PDF this field can be ignored.
You should now see the action in Salesforce Mobile. Trigger a print to test. If you run into any issues, reach out to us.