Berichten

Exact Synergy Word Merge tricks

Exact Synergy offers the possibility the send (bulk)-emails and -letters. This has been possible for years already, but last year this mechanism was completely renewed. This new Word Merge is by default activated for new customers. Customers already using Synergy for over a year can also benefit from these new possibilities. Switching to this new mechanism is quite straighforward and the benefits are great. For more information go to this video or this blog post.

With the new Word Merge, letter- and email-templates can be made in MS Word. In MS Word, the template creator selects which schema to use, where a schema is nothing more than a group of merge fields. Merge fields from the selected template(s) can be dragged into the MS Word template. At the moment a user is creating a letter or sending an email to a customer or colleague, these merge fields will be filled with the correct corresponding data.

Exact delivers a huge set of merge fields by default which are stored in one big schema. Administrators can create their own schemas with their own set of merge fields. He can use default merge fields or add new merge fields to this schema: field that were not delivered by default. How this works, is described in the example below. Credits for this example go to my colleagues Sanja Djuretic and Mahyar Shojaeifar.

A real life example

In this example we will extend a schema used to create a Word Merge template for this scenario: For the request type “I Need” a “TextFreeField4″ is linked to the item. In this example an item with a code 80003 and description Flowers is selected in specific request, as shown in the following screenshot.1picture

 
When the WordMerge template for the letter from Request is created using Exact General schema then mapping TextFreeField4 to the content control in template document will result in showing item code, here 80003, in the final letter. 2picture

– If user wants to show description of the TextFreeField4, in this example Flowers, than it is necessary to extend the schema used for xml mapping by means of adding new metadata and creating new schema related to the new metadata.

One can get new metadata, here item description of the “TextFreeField4″ (“freetextfield_04″ DB name), in 2 different ways:
• By sub query:
<Field name=”ItemDescFromTextFreeField4″ sql=”(SELECT Description FROM Items WHERE ItemCode = {0}.freetextfield_04)” />
• By using join:
<Join name=”ItemFromTextFreeField4″ lookUpEntity=”Items” lookUpJoinType=”left” fieldName=”freetextfield_04″ lookUpKey=”Code”  />

Note that using join it is possible to get more information from the Item while sub query returns only one value, description in here.

-Following section shows the content of new metadata file and schema and explains how and where to save these files.
These files should be created and saved according to the naming conventions and in the folders as described in the document How to: Extending Word Merge schemas

1.Save following metadata as “MailMergeTags.Req.xml” file in the “xml” folder of the Synergy “Exact WordMerge Integrator” installation:

<?xml version=”1.0″ encoding=”utf-8″?>
<eExact>
<Entities>
<Entity name=”Request”>
<Fields>
<Field name=”ItemDescFromTextFreeField4″ sql=”(SELECT Description FROM Items WHERE ItemCode = {0}.freetextfield_04)” />
</Fields>
<Joins>
<Join name=”ItemFromTextFreeField4″ lookUpEntity=”Items” lookUpJoinType=”left” fieldName=”freetextfield_04″ lookUpKey=”Code”  />
</Joins>
</Entity>
</Entities>
</eExact>

2.Save following text as “Req.Schema.xml“. You can save it in the same folder as the above metadata file is saved.

<eExact  xmlns=”Exact extended Request schema”>
<Request>
<ItemDescFromTextFreeField4>Description of item, stored in request free text field no.4</ItemDescFromTextFreeField4>
<ItemFromTextFreeField4>
<AssortmentCode>AssortmentCode</AssortmentCode>
<Description>Description</Description>
<IsSerialNumberItem>IsSerialNumberItem</IsSerialNumberItem>
<LongDescription>LongDescription</LongDescription>
<NetWeight>NetWeight</NetWeight>
<Picture>Picture</Picture>
<StatisticalNumber>StatisticalNumber</StatisticalNumber>
</ItemFromTextFreeField4>
</Request>
</eExact>

3.Upload new schema to the Synergy – click on the Documents menu in the Word Merge section on the Schemas and select New Schema. Choose Request as a group.
Note: It is not necessary to upload new schema to Synergy before you use it to create the Word Merge template but in case that you want to share it with other users we recommend the upload.

-Next step is to update the existing Word document used for Request letter template with the free field description field from the new schema.
This can be achieved by adding new schema in the Xml Mapping pane – add new Custom XML Part –  and then adding new description field to the template document as shown below.
Save and upload this document template to Synergy and you are ready to use it!

The letter created from the Request using latest template (created with the field from extended schema) will contain description for the item selected in related TextFreeField4. 3picture

Our customers and partner can go to this document in the customer portal, where attached is a simple app Word2SQLApp which gets the template, extracts used tags and output final SQL; it can help to understand how template will behave during merge process.

Furthermore, attached here are extended metadata file, schema and template used as examples in this document.

Bron: Exact Product Blog