Email notification of Orders is sent with a PDF copy of the order attached. The default name of the PDF file is a long string of numbers, that you may want to modify to be a more sensible file name that your customers will be happier to receive!
The default name is: O_<TransactionTypeName>_xxxxxxxxxxxxxxx.pdf
Where the "x" represents a long numerical string unique to each order.
For example: O_SalesOrder_342876528.pdf
Your customers may not be thrilled to receive an attachment with this file name :)
You can change the PDF file name to include any fields you wish.
For example: include the customer's name, ID number, order number, or any other field you wish to have in the PDF file name (for details on configuring email notification for orders see How to Set Email Notification for Transactions (Sales Orders).
Say your customer's name is "JohnsGoods" and their Account ID number is 4589, this makes for a much friendlier file name: Order_JohnsGoods_4589.pdf
The file name is determined by an XSLT configuration file. This article provides a sample file you can modify to include any fields you like - "OrderPDFFileName.xslt" attached below.
To modify the file name, you will need to download the file naming configuration file, and then indicate in the PDF template to use that file name.
Step 1: Download the sample file attached and modify it to include the field names you would like to appear in the PDF file name.
The file contains the fields to be used in the PDF file name. In this example the Account Name and Account ID fields, separated by an underscore, comprise the file name. Here are the lines in the file that indicate the field names:
<xsl:value-of select="/SalesTransaction/TransactionHeader/AccountFields/AccountName"></xsl:value-of><xsl:text>_</xsl:text><xsl:value-of select="/SalesTransaction/TransactionHeader/AccountFields/AccountExternalID"></xsl:value-of><xsl:text>.pdf</xsl:text></xsl:template>
You can enter any fields you want, just make sure you enter the full "path" to the field. You can get the path and the field names from the Order XML file.
There is a sample Order XML file (as a txt file) attached at the bottom of this article where you can get the field paths to most fields you will need (and even intuitively figure out the paths for other fields). However, your Transaction may have additional fields you have added, as well as custom fields you may have created. To obtain a copy of the Order XML file from your Pepperi configuration, go to the Workflows tab of the Transaction Type and send a test email to yourself with the Order XML file.
Go to Settings -> Transaction Types -> Edit the Transaction you wish to download the XML for
Go to the Workflows tab, add an Email action with your email address and select "XML" for the attached file. Click "Test" and enter your email address. The Order XML will be emailed to you. You can then delete the email action you added.
For example if you wanted to add the Order number (ExternalID field) to the PDF file name, you would replace the AccountExternalID "path" with:
/SalesTransaction/TransactionHeader/TransactionFields/ExternalID
Step 2: Load the file to the configuration files
Go to Settings -> Configuration Files -> Configuration Files
Click Add New File
File type: Select "Exported Order File Name"
File Name: give a logical name that refers to the file's purpose - such as "RenamePDF Order File"
File Description: enter a descriptive phrase to describe the file
Upload file: browse to the xslt file you modified
Click Save
Step 3: Indicate that the rename file you loaded in step 2 should be used in the PDF configuration file
Edit the PDF configuration file
NOTE: Make sure you are editing the Order object and NOT the GeneralActivity object (the GeneralActivity object also has a PDF template which is used to send emails on Activity Types)
Exported file name: select the file name that you created in step 2
Now whenever you submit an order the PDF file emailed will use the new file name you configured in your xslt file.
1 comment
How Can I get the Value of a Custom Field from the header of the Order,
For example, I've tried <xsl:value-of select="/SalesTransaction/TransactionHeader/CustomTransactionFields/TSACustomField"></xsl:value-of> with no success, I'm unable to find the right path.
Is there a data dictionary for the paths to the fields?
Please sign in to leave a comment.