3. Configuring xTuple Connect to Send Electronic Invoices

Now that you see how simple it is to send an Invoice by email, here is a description of how to set up xTuple Connect to do this. The configuration process has three basic steps:

  1. Review Customer Form Assignments

  2. Create an EDI Profile describing what to send and how

  3. Set up the Customer to receive the email

The example in this section is very simple and illustrates only one way to set up xTuple Connect to send EDI. See Chapter 5, Advanced EDI for more sophisticated examples, including xTuple recommendations.

3.1. Review Customer Form Assignments

The particular report definition that is used when an Invoice is printed or emailed can be determined by the Customer Form Assignment screen. To reach this screen, follow these steps:

  1. Follow this path: Sales > Master Information > Customer Form Assignments

  2. The following screen will appear:

Customer Form Assignments

As you can see in the screenshot, the Customer Form Assignments are based on Customer Type. This means that whenever Invoices are printed for or emailed to this Customer, the Form Assignment for the Customer's Customer Type will be used. In this example, no changes are required. However, there may be cases where you would want to associate different Invoice Forms with different Customer Types.

3.2. Create a Simple EDI Profile

EDI Profiles are the master records which describe what mechanism to use to send data electronically and the basic structure of what will be sent. Our simple example will hold just enough information to send a PDF copy of an Invoice by email to the Accounting department at our Customer.

To create an EDI Profile, start from the System menu:

  1. Follow this path: System > Master Information > EDI Profiles

  2. Click the NEW button

  3. Type "Tremendous Toys Incorporated-IN" in the "Name" field

  4. In the "EDI Profile" window that appears, select "Email" from the list of EDI Types

  5. Click the "Review Before Sending" box

  6. In the "To" field, enter the email address to which you want to send the Invoice: accounting@ttoys.com

    Tip

    You may enter multiple email addresses by separating each address with a comma (",").

  7. In the "Cc" or "Bcc" field, specify addresses you want to receive a copy of the email

  8. If you want replies automatically sent to a particular address, put that in the "Reply To" field

  9. In the "Subject" field, specify a subject: Prodiem </doctypefull> </docnumber>

  10. In the "Message Body" section, enter a detailed message to the Customer to be used whenever Invoices are emailed to the Customer

    Tip

    Make certain the content of your message appears legitimate so that spam filters will not reject it.

    Creating a Customer EDI Profile for Invoicing
  11. Click the NEW button on the "Forms" tab

  12. If you get a dialog asking if you want to save the EDI Profile to the database, click OK

  13. In the window that appears, select "Invoice" from the "Document Type" list

  14. Make sure the File Name field is set. This is the name that will be given to the email attachment. </doctype></docnumber> is usually the best choice

  15. Make sure the "Output Format" is set to "Report" and that the "Report" is set to "[ use Customer Form assignment ]"

    Simple EDI Form for an Invoice

  16. Click OK

  17. Click SAVE on the EDI Profile screen

The following fields on the EDI Profile screen deserve special mention:

Name

The EDI Profile in our example is specific to sending Invoices to the Customer TTOYS. The name reflects this.

Review Before Sending

This setting controls whether or not the user will see the Review EDI Before Sending screen. If this field is checked then all users will see this screen and be able to accept or cancel sending the EDI. If it is not checked, the EDI will be sent automatically; the user will not have a chance to review the information, change it if necessary and allowed, and accept or cancel sending the message.

To, Message Body, Subject

This EDI Profile sets the destination email address specifically to "accounting@ttoys.com" and mentions "Tremendous Toys" in the message body. This is part of what makes this EDI Profile specific to this particular Customer. However, also notice the use of </doctypefull> and </docnumber> in the Subject. These are examples of special tokens that get replaced with the actual Document Type and document number when the EDI message gets built. See Chapter 5, Advanced EDI for ways to create more generic EDI Profiles.

Forms

This EDI Profile only has one EDI Form: IN. That means this EDI Profile can only be used to send Invoices. This EDI Form is described in Section 3.2.2, “EDI Forms”.

3.2.1. EDI Tokens

Tokens are used in EDI Profiles as a means for automatically placing specific information in an email when the email is actually created. There are a few basic tokens available for all supported Document Types. For example, note the </docnumber> in the File Name field of the EDI Form window in Section 3.2, “Create a Simple EDI Profile”—this will be replaced with the actual invoice number when an Invoice is about to be sent.

The following tokens are available to support EDI Profiles wherever they are used:

</docnumber>

The document number (e.g., 60096)

</doctype>

The Document Type (e.g., IN)

</docid>

The primary key id for the document—this is a number used internally by xTuple ERP and not normally shown to users (e.g., 157)

</doctypefull>

A human-meaningful version of the Document Type (e.g., Invoice)

a document-type-specific token

The primary key id for the document, named for the primary key field of that document (e.g., </invchead_id>)

You can also define your own tokens to build more interesting and general EDI Profiles. See Section 1.2.2, “Defining New EDI Tokens” in Chapter 5, Advanced EDI for more information on how to do this.

3.2.2. EDI Forms

Each EDI Profile needs additional information to describe what information should be sent for different Document Types. These extra details are described using EDI Forms. There should be one EDI Form for each Document Type you want to send using an EDI Profile. For example, our sample EDI Profile is only used to send Invoices, so we created exactly one EDI Form for this EDI Profile.

Our sample EDI Form screen shows the basic information for sending an xTuple ERP report when sending Invoices electronically. This EDI Form definition has the following components:

Document Type

This EDI Form describes what to do when sending Invoices. The same EDI Profile could have other EDI Forms for sending other Document Types.

Output Format, Report

Invoices for this EDI Profile will be sent as PDF files generated by running a report. In this case, that report will be whatever the Customer Form Assignment says to use. In this case that will be the report named "Invoice".

File Name

The file name is used by the xTuple Connect Batch Manager to create a temporary file and as the name of the email attachment. If not given here, the xTuple Connect Batch Manager will add an appropriate suffix. In this case, the file name will start with the abbreviated type of document, which will be followed by the document number. Since this is a report, the suffix .pdf will be appended. The end result, as you can see in Section 2, “Receiving Invoice Emails with Attachments”, is IN60096.pdf.

3.3. Setting Up a Customer to Use A Profile

Now that we have an EDI Profile to send Invoice PDF files to the Customer TTOYS, we have to instruct xTuple Connect to use this EDI Profile:

  1. Follow this path: Sales > Customer > List

  2. Open the TTOYS record for editing

  3. Select the "Transmission" tab

  4. Click the ATTACH button, which brings up the following screen

    Attaching the new EDI Profile to the Customer

  5. Select "Invoice" for the Document Type

  6. Select "Tremendous Toys Incorporated-IN" from the list of EDI Profiles

  7. Click the ATTACH button

You should now see the "Tremendous Toys Incorporated-IN" profile listed on the Transmission tab in the Customer window.