Mapping Templates

Turn external spreadsheet columns into consistent, reusable bulk imports.

Mapping Templates in Compound Direct define how the columns in a CSV file correspond to customer, prescriber, product, prescription, draft, order, account, delivery, and e-prescription information. A mapping template is required before starting a bulk import, and can be reused whenever a source file follows the same layout.


Templates can also supply default values, require important information, and apply rules that standardise or validate each row before it is imported. Setting up the template carefully reduces repeated data entry and makes each bulk import easier to review.

This guide will help you:

  • Create a mapping template from an existing CSV file or by selecting mapped fields.
  • Configure source columns, default values, required fields, and mapping rules.
  • Download a blank CSV template, start an import, and manage existing templates.

A mapping template is a prerequisite for bulk importing drafts. Once your template is ready, see the Bulk Imports guide.

Finding a mapping template

  1. Go to the ā€˜Settings’ page.
  2. Click on ā€˜Templates’.
  3. Select ā€˜Mapping Templates’.
    1. You can also go to ā€˜Bulk Imports’ and click ā€˜Manage Templates’ on the ā€˜Bulk Import Dashboard’.
  4. The ā€˜Mapping Templates’ page displays each template's Name and Description, Template Type, Date Created, and Last Used date.
  5. Begin typing the template name in the search search bar to refine the list.
  6. Click the desired ā€˜Mapping Template’ to view or edit it.

Planning a mapping template

Before creating a template, identify which columns your source system provides and which Compound Direct fields they should populate.

  1. Use one row in the CSV file for each draft you intend to create.
  2. Keep the source column headings consistent between files. A saved Source column should match the corresponding CSV heading.
  3. Include enough information to identify the required customer and product for every active row.
  4. Add prescription, prescriber, delivery, account, or order fields only when they are needed for your workflow.
  5. Decide which values are supplied by the CSV and which should be supplied by a template Default Value.
  6. Decide which fields must be completed before drafts can be created, then mark those mappings as Required.

Available mapped fields reflect the features enabled in your workspace. For example, order, account, veterinary, and e-prescription fields only appear when the related functionality is available.

Creating a mapping template

  1. Go to the ā€˜Mapping Templates’ page.
  2. Click ā€˜Create Template’.
  3. Enter a clear Template Name.
  4. Enter a Description that identifies the source system, file type, or intended workflow.
  5. Build the ā€˜Column Mapping’ in either of the following ways:
    1. To scan an existing layout, upload or drag and drop one .csv file into ā€˜Upload import file to be scanned’.
      1. Compound Direct reads the first row as the source column headings.
      2. Where a heading resembles an available Compound Direct field name, the corresponding Mapped field is selected automatically.
      3. Review every automatically selected field before saving.
    2. To build the template manually, click ā€˜Add Mapped Field’ or ā€˜Add Mapped Fields’.
      1. Search for a field or expand a category.
      2. Tick each field you want the template to support.
      3. Click ā€˜Done’.
  6. Configure each row in ā€˜Column Mapping’:
    1. In ā€˜Source column’, enter the heading used in the CSV file.
    2. In ā€˜Default Value’, optionally enter a value to use when the source value is blank or the source column is not supplied.
    3. Tick ā€˜Required’ when the mapped value must be present before the item can proceed.
    4. Under ā€˜Mapped field’, select the Compound Direct field that receives the value.
  7. Drag the reorder icon to arrange the mappings in a practical review order.
  8. To remove a mapping, click the delete_outline icon beside it.
  9. Add any required Mapping Rules.
  10. Click ā€˜Create Template’.

Each source column shown in the mapping table must have a Mapped field, and each mapped field can only be used once. Remove any source columns you do not want to import.

Understanding column mapping

Each mapping row controls how one value is prepared for the import.

SettingHow to use it
Source columnEnter the CSV heading that contains the value. Keep the spelling and spacing consistent with the source file.
Default ValueEnter a value to use when the source cell is blank or the column is absent. A default is useful for values shared by every row, such as an order workflow or tag.
RequiredTick this when an empty value should be treated as an issue that must be resolved before draft creation.
Mapped fieldSelect the Compound Direct field that will receive and use the value.

When you use ā€˜Get Template’, columns with a Default Value are omitted from the downloaded file because the template can supply those values automatically.

Common mapped-field formats

  1. Enter dates in your workspace date format or as YYYY-MM-DD.
  2. For a Yes/No field, use TRUE, YES, Y, or 1 for Yes. Other or blank values are treated as No.
  3. Separate multiple tags with commas in fields such as Tags, Customer Tags, or Order Tags.
  4. Enter percentages as numbers between 0 and 100 where a percentage field is used.
  5. Enter currency and quantities as numbers without explanatory text.

Mapped fields that affect later processing

FieldUser-facing effect
Customer ID / Prescriber IDUses the existing Compound Direct record with that ID. An invalid ID must be corrected during reconciliation.
Min Match % / Min Name Match %Sets the minimum customer matching thresholds for that row. Use values from 0 to 100.
Product NameProvides the product search term used during reconciliation. Always verify the selected product before creating drafts.
Product CodeSupplies the formulation or stock reference code from the source file. Include Product Name as well unless your tested source workflow reliably resolves by code.
Price NameSelects a named drug multipack or formulation price when that name is available.
Repeat On FileAttempts to create the draft from an eligible existing repeat for the same customer and product.
BarcodeImports one supported e-prescription item. A barcode cannot be reused by another row in the same import.
E-Script Repeat EmailSets the email address that should receive the repeat token.
Purchase Order NoGroups rows with the same purchase order number into one order, unless grouping by customer is enabled.
Group Order By CustomerGroups all eligible rows for the same matched customer into one order.
Order WorkflowApplies the named order workflow. Use the exact workflow name where possible.
Discount Percentage / Discount AmountApplies one form of discount. Do not provide both for the same row.
Discount Applied To ItemApplies the discount to the line item instead of the whole order.
Item Is ArchivedArchives the row during reconciliation so it does not create a draft.

For the complete set of available fields and their descriptions, click ā€˜Add Mapped Fields’ and expand the Customer, Prescriber, Delivery Address, Product, Prescription, Draft, Order, Account, ePrescription, and Mapping categories.

Adding mapping rules

Mapping Rules conditionally change or validate row values. Use them when the same source layout needs different outcomes depending on the contents of a row.

  1. Create or open a mapping template.
  2. Under ā€˜Mapping Rules’, click ā€˜Add Rule’.
  3. Enter an optional Rule name so the rule's purpose is easy to recognise.
  4. Leave ā€˜Rule enabled’ switched on for the rule to run during imports.
  5. Under ā€˜When’, configure the condition:
    1. Select whether to inspect a Source column or a Mapped field.
    2. Select or enter the column or field.
    3. Choose a comparison, such as equals, does not equal, contains, starts with, ends with, a greater/less than comparison, is empty, or is not empty.
    4. Enter the Comparison value when required.
  6. To use more than one condition, click ā€˜Add Condition’ and select whether all conditions are true (AND) or any condition is true (OR).
  7. Under ā€˜Then’, configure one or more actions. A rule can:
    1. Set a mapped field to a value.
    2. Copy from a source column or another mapped field.
    3. Append, prepend, remove, or replace text.
    4. Add, subtract, multiply, or divide a number.
    5. Clear a mapped field.
    6. Add an issue to the whole row or to a related field with a user-readable message.
  8. If needed, tick ā€˜Do not run this rule when these conditions are true’ and configure the exception conditions.
  9. Tick ā€˜Stop processing later rules when this rule matches’ if no later rule should change the row after this rule succeeds.
  10. Click ā€˜Save Rule’.
  11. Review the When and Then summary shown on the rule card.
  12. Drag the drag_indicator icon to change the order in which rules are applied.
  13. Click ā€˜Duplicate’, ā€˜Edit’, or ā€˜Remove’ to manage an existing rule.
  14. Click ā€˜Save Template’ when finished.

Rules run in the order shown. A later rule can use or change a value produced by an earlier rule unless ā€˜Stop processing later rules’ is enabled.

If a rule refers to a source column that is not directly mapped, make sure that heading is present in the CSV file. ā€˜Get Template’ only guarantees the inclusion of directly mapped source columns.

Using the JSON rule editor

The Visual / JSON toggle provides an advanced editor for specialised rules.

  1. Click the ā€˜Visual / JSON’ toggle to view the rule as JSON.
  2. Only edit the JSON if you understand the rule format used by your workspace.
  3. Resolve any validation message before clicking ā€˜Save Rule’.
  4. Toggle back to ā€˜Visual’ when the rule can be represented by the visual editor.

Some advanced JSON expressions cannot be represented by the visual editor. In that case, continue editing the rule in JSON or simplify the rule.

Testing and downloading a mapping template

  1. Save the mapping template.
  2. Click ā€˜Get Template file_download’ to download a blank CSV containing its source headings.
  3. Open the file and confirm that the headings match the export produced by your source system.
  4. Add a small set of representative rows, including any unusual customer, product, order, or prescription scenarios.
  5. Start a test import and review the ā€˜Uploaded’ and ā€˜Drafting’ stages before creating drafts.
  6. If columns map incorrectly or repeated issues appear, return to the mapping template, make the correction, and use a new test import.

Changing a mapping template does not remap rows that have already been added to an import. Test the updated template with a new import.

Starting an import from a mapping template

  1. Open a saved, unarchived mapping template.
  2. Ensure there are no unsaved changes.
  3. Click ā€˜Start Import’.
  4. In the ā€˜New Import’ modal, either:
    1. Upload or drag and drop a completed .csv file; or
    2. Click ā€˜Create Without CSV’ to add rows manually.
  5. Continue with the Starting a bulk import guide.

Editing and managing mapping templates

  1. Go to the ā€˜Mapping Templates’ page.
  2. Select the desired template.
  3. Update the Template Name, Description, column mappings, defaults, required fields, or mapping rules.
  4. Click ā€˜Save Template’.

To duplicate a mapping template:

  1. Open the mapping template.
  2. Click the ā€˜More actions’ menu.
  3. Select ā€˜Duplicate Template’.
  4. Update the duplicate's name or settings, then click ā€˜Save Template’.

To archive or unarchive a mapping template:

  1. Open the mapping template.
  2. Click the ā€˜More actions’ menu.
  3. Select ā€˜Archive’ or ā€˜Unarchive’.

Archived templates cannot be selected for a new import until they are unarchived.

Customising import columns with a mapping template

The table layout used during an import is saved with its mapping template, helping repeated imports use a consistent review layout.

  1. During an import, open the ā€˜Uploaded’, ā€˜Drafting’, ā€˜Queued’, or ā€˜Dispensed’ tab.
  2. Click ā€˜Columns’.
  3. Tick the fields you want displayed and untick fields you want hidden.
  4. Click ā€˜Done’.
  5. Drag a column boundary to resize it, or double-click the boundary to reset its width.
  6. Click the push_pin icon in a column heading to pin or unpin the column where available.

Column visibility, widths, and supported pinned-column choices are retained on the mapping template and can affect later imports that use it.

Was this page helpful?

Ā© 2026 Compound Direct. All rights reserved.