> For the complete documentation index, see [llms.txt](https://kb.bevica.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.bevica.com/documentation/integration/bevica_warehouse_integration/setting_up_communication_engine_for_vision_pre-advices.md).

# Setting up Communication Engine for Vision Pre-Advices

Configure Communication Engine mappings for Vision pre-advice messages.

{% hint style="warning" %}
**Prerequisites**

Account with a Vision managed warehouse: LCB, Vinotheque, Lanchester, EHD, Coterie Vaults.
{% endhint %}

## Communication Engine

The communication engine is a solution framework to enable the communication of data between Bevica and various endpoints such as a Vision warehouse.

## Initial Setup

If you are not already using the communication engine to send or receive other files from the warehouse, e.g., orders, you will need to complete some initial setup. If you are already using the communication engine, you can skip this part and move to setting up the communication engine route.

**1. Warehouse Integration Setup**

You will need to populate the following Vision account information in the Warehouse Integration Setup record. The information will be supplied by Vision or your warehouse.

* Path to API e.g.

&#x20;         <http://kingmoor.lcb.co.uk> (LCB)

&#x20;         <http://edi.ehdlondon.co.uk> (EHD)

&#x20;         <http://kingmoor.lanchestergroup.com> (Lanchester)

* Customer Code
* Site Code
* API Username (Client ID)
* API Password (Client Secret)

**2. Communication Engine Setup**

Prior to setting up any communication engine routes, you need to initialise the communication engine. To do this:

1. Search for **Communication Engine Setup** and select to **Initialise Setup**. Note that if you receive an error about the TVTCOM package, this can be ignored.
2. Search for **Warehouse Integration Setup**, open the **Warehouse Supplier Setup** card, and select **Actions, Create Communication Engine Auth.**

{% hint style="info" %}
Users will need the **COMMUNICATION ENGINE permission set** to access this functionality if they are not a super user.
{% endhint %}

## Setting up a Communication Engine Route

You will need to set up a new communication engine route for [Vision Pre-Advice Outbound Requests](/documentation/integration/bevica_warehouse_integration/warehouse_pre-advice_integration.md). To do this, search for **Communication Engine Routes** and create a new record. Populate the fields as follows:

| Field                   | Note                                                                                                                                                                                                                                                                                                                                            |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Code                    | Enter a code for the record e.g. LCB\_PREADVICE                                                                                                                                                                                                                                                                                                 |
| Type                    | Http                                                                                                                                                                                                                                                                                                                                            |
| Direction               | Outbound                                                                                                                                                                                                                                                                                                                                        |
| Communication Code      | <p>• Enter a Code, e.g. LCB\_PREADVICE<br><br>• End Point = /service/PreAdvice<br><br>• is the URL base e.g.<http://kingmoor.lcb.co.uk><br><br>• Content Type = application/xml<br><br>• Method = Post<br><br>• Request Body Required = Yes<br><br>• Authentication Code, drill down and select the record that has been created e.g. LCB01</p> |
| Description             | Enter a description                                                                                                                                                                                                                                                                                                                             |
| Route Action            | Vision Preadvice Export                                                                                                                                                                                                                                                                                                                         |
| Synchronise Routes      | Tick this                                                                                                                                                                                                                                                                                                                                       |
| Process Message         | Tick this                                                                                                                                                                                                                                                                                                                                       |
| Task Scheduler          | Tick this if you are going to set up the job queue                                                                                                                                                                                                                                                                                              |
| Task Sched. Parameter   | Populate this, e.g. PREAD\_REQ. This will be the value to populate the Parameter String on the job queue for codeunit 68807. See below.                                                                                                                                                                                                         |
| Whse. Integration Setup | Select the relevant Warehouse Integration Setup record.                                                                                                                                                                                                                                                                                         |

## Retention policy setup

If you don't have this setup already, you can define a retention policy to delete outdated communication engine message records. To do this:

{% stepper %}
{% step %}

### Step 1

Choose the ![](https://2932934759-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfUgpGDVvyqBWVvwVIy9a%2Fuploads%2Fgit-blob-d08791d5454211f4ad6c103dcb698478e14f0cc7%2FlkSQid0_R5gHXL6QmCsGIS4HBwZVQYDsmg.png?alt=media) icon, enter **Communication Engine Setup**, and then choose the related link.
{% endstep %}

{% step %}

### Step 2

Select Setup Comm. Messages Retention Policy.
{% endstep %}

{% step %}

### Step 3

Amend the defaults if required and select to **Enable**.
{% endstep %}
{% endstepper %}

For more information, see [Retention Policies](https://learn.microsoft.com/en-gb/dynamics365/business-central/admin-data-retention-policies).

## Exporting files manually

Whilst you are testing the API functionality, you can run the process manually:

1. **Process Outbound Requests**
   * From the Outbound Request Page, select **Process Requests** in the ribbon. Populate the Whse. Integration Setup Code and select to Generate and Send Requests. Optionally filter on Entry Number or Supplier Request Code = PREAVICE.
   * This will create the file, mark the Outbound Request as Sent, and create a communication engine message.
2. **Send the Communication Engine message to Vision**
   * From the Outbound Request Page, select **Comm. Engine Routes** in the ribbon. You should see the route for Preadvices with a number in the No. of Pending Messages column.
   * Select Run Communication Engine to send the message to Vision. This should move the message to the No. of Messages Completed column.

## Setting up the job queues

Once you are happy with the functionality, you can set up the job queues to run these two functions.

1. **Process Outbound Requests**
   * This will create the file, mark the Outbound Request as Sent, and create a communication engine message.
   * Create a job queue entry for **Report 71303 Whse. Integration Process Outbound Requests**.
   * On the **Report Request** page, populate the **Whse. Integration Setup** code and toggle on **Generate Requests** and **Send Generated Requests**. Optionally populate the **Supplier Request Code** = PREADVICE to send Orders and Pre-Advices separately.
   * Set the job queue entry to run on relevant days, e.g., Monday to Friday.
   * Set the Starting Time and Ending Time.
   * Set the job queue to Ready.
2. **Send the Communication Engine message to Vision**
   * This will send the communication engine message to Vision.
   * Create a job queue entry for **Codeunit 68807 TVTCOM Run from Job Queue**.
   * Set the Parameter String to be the same as the Task Sched. Parameter value on the Communication Engine Route record for the pre-advice record e.g. PREAD\_REQ.
   * Set the job queue to run on relevant days, e.g., Monday to Friday.
   * Set the Starting Time and Ending Time.
   * Set the job queue to Ready.

## Troubleshooting

See [Communication Engine Messages](/documentation/integration/bevica_warehouse_integration/communication_engine_messages.md) for details of how communication engine messages are generated and what to do if the message errors.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kb.bevica.com/documentation/integration/bevica_warehouse_integration/setting_up_communication_engine_for_vision_pre-advices.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
