Orbis Article: 31-10517 Task Exercise; Example 20 - Word Merge
Page: 2 Task Exercise; Example 20 - Word Merge Created Date: 02/12/2014 - Last Updated Date: 02/12/2014 Before this exercise can be completed, the TaskCentre training database must first be installed. This will allow access to specific task data and data sources which are relevant to the exercise. Please follow the below link for instructions on how to install the training database: Learn about: How to install the TaskCentre Training Database This exercise uses the Output tool Send Email (SMTP). For the email to be received with the task results a working email environment needs to be in place. Your company domain can be used or a demonstration environment can be setup. Please follow the below link for instructions on how to create a demonstration system, specifically Mail Routing: Learn about: Installation and Upgrade Creating a Demonstration System Introduction The Exercise This exercise will demonstrate how data from a TaskCentre database query can be used to populate and complete a MS Word document by mapping the database query recordset columns to parameters within the Word document. This example task is based on a scenario where a notification email is sent to a customer advising them that their order has been received. The notification will present the word document as HTML within the main body of the email as well as providing it as an attachment in document form. This exercise will make use of 3 tools: Database Query (OLEDB), Merge MS Word Document and Send Message (SMTP) The database query step has already been provided, you will be created the Word Merge and Email steps. 1.0 Accessing the Task 1. Within TaskCentre navigate to the Tasks -> Training folder 2. Open the task named Example 20 - Sales Order Acknowledgement 2.0 Setting the Database Connection Before proceeding, the Database Query step will first need to have a connection configured to the Training Database.
Page: 3 1. Double click the step DBQ - Get New Orders, a message will appear asking for a connection. Click OK and using the Connection drop down menu within the tool set the connection to TCTrainingDB. 2. Select the Query tab to obtain an overview of how the query is functioning. Click the Execute icon in the toolbar to run the query. Three orders numbers will display. 3. Click OK to save and return to the task planner. 3.0 Adding the Word Merge Step 1. Using the Tools tab of the task browser, locate the Merge MS Word Document icon under the Format tools. 2. Drag the icon onto the Task Planner. This will automatically open the General tab of the tool. 3.1 General tab Here we will specify a name for the step and select a database query recordset for the step to consume. This will allow data from the query to be used when configuring the step. Complete the General tab as follows: 1. In the Name field enter: Merge Sales Order Acknowledgement 2. Tick the box Use a recordset 3. The Input Recordset field will display: Results from Get New Orders 4. Select the Main tab. 3.2 Main tab - Importing a Word Document Template Here a Word document is imported into the tool for running, the document has been created with parameter fields which will allow data from the database query to be mapped in. One document will be generated for every row of the database query recordset. 1. Click on the Import button which will open a file browser window 2. Open the file Sales Order Acknowledgement.doc located within the TaskCentre Training folder: TaskCentre_Training -> Training_Resources -> Templates -> Word Merge Docs 3. Select NO when asked to run the SQL command. Once imported the Main tab will look as follows:
Page: 4 3.3 Mapping Recordset columns 1. From within the Environment tab of the task browser, drag & drop columns from the RecordSource into Data source column of the Field mapping table so that each column matches the Mail Merge Field parameter. 2. Select the option New document for each row. The main tab should now look as follows:
Page: 5 3. Select the Document properties tab 3.4 Document Properties 1. Tick the box Override existing document properties. 2. In the Title field enter: Automated Document Delivery 3. In the Subject field enter: Order Acknowledgement 4. For the Author field we will use a task property called Owner. Within the Environment tab of the task browser, change the Scope field to Task then drag & drop the property Owner into the Author field. 5. In the Company field enter: Orbis Software
Page: 6 6. No changes need to be made to the Advanced and Options tabs so this completes configuring the Merge MS Word Document. Click OK to save and return to the task planner. 4.0 Adding the Email step 1. Using the Tools tab of the task browser, locate the Send Message (SMTP) icon under the Output tools. 2. Drag the icon onto the 'Task Planner'. This will automatically open the General tab of the tool. 4.1 General Tab Complete the General tab as follows: 1. In the Name field enter: Send Order Acknowledgement 2. Tick the box Read documents from a source 3. Using the Documents Source drop down list select: Documents form Merge MS Word Document [HTML]
Page: 7 4. Select the Main tab 4.2 Main tab For the purpose of this example we will specify yourself as the recipient so that you will receive the email notification. If using the demonstration environment with the ArgoSoft Mail server then the email address will be demo@taskcentre.com 1. Click the From button 2. Tick the box One off / Dynamic Address and within the fields type the following: Display Name: DemoSender Address: demo@taskcentre.com 3. Select OK to return to the Main tab 4. Click on the To button 5. Select New to specify an email address. 6. Provide your name in the Name field 7. Provide your email address in the Address field. (If using the demonstration environment then this address will be
Page: 8 demo@taskcentre.com) 8. Select OK to return to Select Recipients 9. Select OK again to return to the Main tab 4.3 Adding an attachment 1. Click on the Attach... button to open the Attachments box 2. Click on Add to open Edit Attachment 3. Select the options Dynamic Attachment and File From Document 4. Within the task browser expand the Recordset node under Send Order Acknowledgement then drag & drop the column Name into the File From Document field 5. At the end of the line enter the text:.doc 6. Click OK which will return to the Attachments box where the newly created attachment will appear in the table.
Page: 9 7. Click OK to return to the Main tab of the tool. 4.4 Email Subject 1. For the subject begin by entering the text: Order Acknowledgement for Order: 2. From the task browser drag & drop the column ORDER_NUMBER so that it appears after the text. 3. Ensure the option Document Output has been selected. The main tab should now look as follows: 4. This completes configuring the Send Message (SMTP) step. Select OK to save and return to the task planner. 5.0 Linking the Steps The steps must now be linked so the task can execute correctly. This is done by selecting a step and dragging it on to the next step along. In the task planner drag the step icons onto each other in the following order: 1. Get New Orders -> Merge Sale Order Acknowledgement 2. Merge Sale Order Acknowledgement -> Send Order Acknowledgement
Page: 10 4. Click OK to save and close the task. 6.0 Running the Task The view will return to the TaskCentre main page. In order to test the task it needs to be run as follows: 1. Navigate to the Tasks -> Training folder 2. Right-click the task Example 20 - Sales Order Acknowledgement 3. Select Queue Now from the menu The task will run immediately and will display in the Active Tasks pane. If the task fails the fault information will be held in Manage -> Event Log. Task Results You will receive 3 email notifications, each one will relate to a separate order. The email will display the contents of the generated Word document and will also have the document attached. This completes the training exercise.