# Configuring HACCP Plan Translation (HACCP)

[QualityOne Vaults](/en/lr/576286/) let you create and manage [translated](/en/lr/771989/) versions of finalized _HACCP Plans_ for local factory use. Before configuring HACCP Plan Translation, you must first [configure HACCP](/en/lr/492247/) in your Vault.

HACCP Plan Translation is available for all [languages supported for Vault UI translation](/en/lr/16678/).

## HACCP Plan Translation Terminology {#terminology}

This article uses the following terminology to refer to HACCP Plan Translation concepts:

* **HACCP Plan Design**: A model _HACCP Plan_ that factories can copy and translate for local use.
* **Master data object**: A type of [reference object](/en/lr/492246/#reference) that defines generic data used to create transactional records across multiple _HACCP Plans_. For instance, users can create _HACCP Plan Process Steps_ using predefined _Process Steps_. See [Standard Master Data & Translation Companion Objects][14] for a list of standard master data objects.
* **Translation companion object**: An object that corresponds to a master data object and that stores translated copies of transactional or master data. See [Standard Master Data & Translation Companion Objects][14] for a list of translation companion objects.
* **Transactional object**: An object that stores data for a specific _HACCP Plan_. For instance, _HACCP Plan Process Steps_ represent steps in a specific _HACCP Plan_. Vault copies transactional object records when you [deep copy a _HACCP Plan_](/en/lr/492246/#deep-copy) or [generate a translation copy of a _HACCP Plan_](/en/lr/771989/#generate).
* **Translation copy**: A translated copy of an approved model _HACCP Plan Design_ that factories can copy for local use.

## Standard Master Data & Translation Companion Objects {#standard-md}

The following objects are standard master data objects and their corresponding standard translation companion objects:

* _CCP Library_ > _Critical Control Translation_
* _Detectability_ > _Detectability Translation_
* _Formulation_ > _Formulation Translation_
* _Hazard_ > _Hazard Translation_
* _Material_ > _Material Translation_
* _Occurrence_ > _Occurrence Translation_
* _Process Step_ > _Process Step Translation_
* _Risk Level_ > _Risk Level Translation_
* _Risk Matrix_ > _Risk Matrix Translation_

You can configure custom objects as additional master data objects. See [Defining Custom Master Data Objects][4] for more information.

## Configuration Overview {#config}

Configuring your Vault to use HACCP Plan Translation involves the following steps:

* [Add the translation generation actions to the HACCP Plan object][3]
* [Optional: Define custom master data objects][4]
* [Optional: Configure master data object layouts][12]
* [Optional: Define custom transactional objects][5]
* [Configure the _Details_ section of object records to display translated master data][6]
* [Configure related object sections to display translated master data][7]
* [Configure the HACCP Flow Diagram to display translated master data][8]
* [Configure translated reference constraints][9]
* [Configure user permissions][10]

<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: Depending on your Vault’s creation date and which features are currently enabled and configured, some of the steps described in this article may be unavailable or already complete in your Vault.</p>
    </div>
  </div>
</div>



## Configuring Translation Generation User Actions {#user-actions}

[Add](/en/lr/43127/) the following record actions to the _HACCP Plan_ object and as [user actions](/en/lr/59885/#user-actions) on the relevant _HACCP Plan Lifecycle_ states to make them available on _HACCP Plan_ records:

* _Generate Translation Copy_
* _Export Translatable Fields_
* _Import Translatable Fields_

## Defining Custom Master Data Objects {#define-custom-objects}

If your organization uses custom master data objects in _HACCP Plans_, you must configure these objects for translation by creating _HACCP Master Data Object_ records. When you create a _HACCP Master Data Object_ record, Vault creates a translation companion object to store translated data for the custom object.

To create a _HACCP Master Data Object_ record:

1. Navigate to **Admin > Configuration > Application Configurations > HACCP Master Data Objects**.
2. Click **Create**.
3. Enter a **Name**.
4. Select a **Master Data Object**.
5. Optional: Enter a **Parent Object Reference**. This value must be a field on the master data object that refers to another existing master data object.
6. Leave the _Translation Companion Object_ field blank and click **Save**.

When creating a new translation companion object, Vault does not copy fields from the reference object to the translation companion object. Add any required fields to the newly created translation companion object. Add a _Lookup_ field to the translation companion object for any object reference fields on the custom master data object that use reference constraints that need to be translated.

## Configuring Master Data Object Layouts {#master-data-layouts}

To display a list of all translation companion records for a master data record, update the object [layout](/en/lr/26387/#how-to-add-sections) of master data objects to add a related object section for their corresponding translation companion object. See [Standard Master Data & Translation Companion Objects][14] for a list of standard master data objects and their corresponding translation companion objects. If your organization uses custom master data objects, ensure you also complete this step for any [custom master data objects][4] you define.

## Defining Custom Transactional Objects {#copy-custom-objects}

If your organization uses custom transactional objects as part of your _HACCP Plan_ related record structure, you must configure these objects for inclusion in HACCP deep copy actions by creating _HACCP Plan Copy Object_ records. The _HACCP Plan Copy Object_ component specifies which transactional records are copied when the _Create HACCP Plan from Design_, _Create HACCP Plan Design from Design_, and _Generate Translation Copy_ actions run.

The pre-configured _HACCP Plan Copy Object_ records in your Vault cover the [standard transactional objects](/en/lr/492246/#deep-copy). You can create _HACCP Plan Copy Object_ records to include additional custom objects in the deep copy actions, or modify existing records as needed.

Vault automatically copies all fields configured on the custom transactional object except for object reference fields that must contain the value of a translated object record. You must set the _Name_ (`name__v`) field to be [system-managed](/en/lr/30986/#how-to-configure-system-managed-object-record-names) for all custom and standard transactional objects. To configure Vault to reference the translated version of transactional records in object reference fields, you can create _HACCP Plan Copy Object Field_ records.

To create a new _HACCP Plan Copy Object_:

1. Navigate to **Admin > Configuration > Application Configurations > HACCP Plan Copy Objects**.
2. Click **Create**.
3. Optional: Enter a **Label**.
4. Enter a **Name**.
5. Select an **Object**.
6. Enter a **Reference Field** in the following format: `Field.[field_name__v]`. For example, `Field.haccp_plan__v`. This value must be an existing object reference or parent object reference field that refers to a transactional object.
7. Optional: Enter a **Join Field**.
8. Optional: Enter a **Self Reference Field**. This value is required to configure Vault to reference the translated version of a record in a self-referencing field.
9. Enter a **Create Order**. This value must be unique across _HACCP Plan Copy Objects_.
10. Enter a **Create Stage**. The _Create Stage_ must match the _Create Order_.
11. Click **Save**.
12. Optional: To configure Vault to reference translated transactional records on the translation copy of a _HACCP Plan Copy Object_, click **Create** under the _HACCP Plan Copy Object Fields_ section.
13. Enter a **Name**.
14. Enter a **Field** in the following format: `field_name__v`. This value must be an existing object reference or parent object reference field that refers to another transactional object.
15. Set the **Copy Behaviour** to _SWAP_VALUE_.
16. Click **Save**.

## Configuring Translated Master Data to Display in Details Sections {#details-section}

You can configure fields that reference master data records to display translated field data in the _Details_ section of object records. The _Translated Field_ control field is available on the object layout for the following objects:

* _HACCP Plan Process Step_
* _HACCP Hazard Control_
* _Process Hazard Analysis_
* _CCP-Hazard Analysis_

All translated fields must refer to [standard](/en/lr/771989/#translate) or [custom][4] master data objects that have a corresponding translation companion object.

<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: You cannot configure translated master data from the <em>Material</em> object to display in <em>Details</em> sections.</p>
    </div>
  </div>
</div>



To display translated field data in the _Details_ section of records:

1. Navigate to **Admin > Configuration > Object Setup > Objects > [Target Object] > Layouts**.
2. Click on the layout on which you wish to display translated field data.
3. Under _Details_, click **Add** (**+**).
4. Select the **Translated Field** control field with the slider (<img class="inline" src="https://platform.veevavault.help/assets/images/CPC-Icon-Slider.png" alt="Slider Icon" style="" />) icon.
5. In the _Add Translated Field_ dialog, select the **Field to Translate**. Object reference fields configured on the target object that refer to translation companion objects are available to select. 
6. Click **Save**.

## Configuring Translated Master Data to Display in Related Object Sections {#related-object-section}

You can display translated data from [standard](/en/lr/771989/#translate) and [custom][4] master data objects in fields on related object sections on _HACCP Plan_, _Process Hazard Analysis_, and _Ingredient Hazard Analysis_ records. This requires configuring _HACCP App Controls for Related Section_ component records. When configured, translated master data displays in a column of the related object section. You must create a _HACCP App Controls for Related Section_ record for each related object section that displays translated master data.

<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: Translated master data from the <em>Material</em> object can only be configured to display in the <em>HACCP Plan Materials</em> control section on <em>HACCP Plans</em>. See <a href="#materials-section">Configuring the HACCP Plan Materials Section to Display Translated Data</a> for more details.</p>
    </div>
  </div>
</div>



The following objects are configurable as translated related object sections:

* _HACCP Hazard Control_
* _HACCP Plan Process Step_
* _Process Hazard Analysis_
* _CCP-Hazard Analysis_

Before you start, complete the following prerequisites:

* The master data object for which you wish to display translated field data must have a translation companion object.
* On the related object, an object reference field must exist that references the master data object for which you wish to display translated data.
* The fields you wish to display in the related object section must exist on both the master data object and its translation companion object.
* A related object section is [configured](/en/lr/26387/#how-to-add-sections) on the layout of the object on which you wish to display translated field data in a related object section.

To configure a related object section to display translated field data:

1. Navigate to **Admin > Configuration > Application Configurations > Component Setup > HACCP App Controls for Related Sections**.
2. Click **Create**.
3. Enter a **Name**.
4. Select a **Related Object**.
5. Leave the _Enable App Control on Section_ checkbox blank or set to **No**.
6. Click **Save**.
7. Under the _HACCP Related Object Translation App Controls_ section on the newly created _HACCP App Controls for Related Section_ record, click **Create**.
8. Enter a **Name**.
9. Select a **Related Object**. This value must match the object specified in the parent record.
10. Enter a **Field** in the following format: `Field.[field_name__v]`. For example, `Field.process_step__v`. This must be a reference field to a master data object that exists on the related object.
11. Click **Save**.
12. Create a _HACCP Related Object Translation App Controls_ record for each field you wish to display in the related object section.
13. Under the _HACCP Related Object Sections_ header on the _HACCP App Controls for Related Section_ record, click **Create**.
14. Enter a **Name**.
15. Select an **Object** on which to display the related object section.
16. Click **Save**.
17. Click **Edit** on the original _HACCP App Controls for Related Section_ record.
18. Set the **Enable App Control on Section** checkbox to **Yes**.
19. Click **Save**.
20. Navigate to a _HACCP Plan_ record through **Business Admin > HACCP Plans** or a _HACCP_ tab.
21. Open the **Actions** menu of the related object section and select **Edit Columns**.
22. Select and add the column for the translation companion object in the _Select Columns to Display_ dialog.
23. Click **Save**.

### Configuring the HACCP Plan Materials Section to Display Translated Data {#materials-section}

You can display translated _Material_ data in the _HACCP Plan Materials_ section according to the language of the _HACCP Plan_. To do this:

1. [Insert](/en/lr/26387/#how-to-add-sections) the _HACCP Plan Materials_ control section with the slider (<img class="inline" src="https://platform.veevavault.help/assets/images/CPC-Icon-Slider.png" alt="Slider Icon" style="" />) icon into the _HACCP Plan_ [layout](/en/lr/26387/#how-to-access-page-layouts).
2. [Add](/en/lr/26387/#how-to-edit-related-object-columns) the _Material Translation_ field as a default column in the layout to display the translated _Material ID_ (`name__v`) field value with a link to the translated record.
3. Optional: To display translated values for standard picklist fields on the _Material_ object: 
   1. Create [_Lookup_ fields](/en/lr/28740/#How_to_Add_Lookup_Fields) on the _HACCP Plan - Material_ object that reference _Material_ object standard picklist fields. With this configuration, the values of standard picklist fields on the _Material_ object, such as _Product Hierarchy Type_, are automatically translated into the user's language.
   2. [Add](/en/lr/26387/#how-to-edit-related-object-columns) the fields you created as default columns in the _HACCP Plan Materials_ section.
4. Optional: To display translated values for text fields on the _Material_ object:
    1. Create [_Lookup_ fields](/en/lr/28740/#How_to_Add_Lookup_Fields) or [_Formula_ fields](/en/lr/44478/) on the _HACCP Plan - Material_ object that reference text fields on the _Material Translation_ object. We recommend _Lookup_ fields for simple configurations that directly display the field value, and _Formula_ fields for complex configurations requiring flexibility to add parameters. As a simple example, a base _Formula_ field to display the translated _Title_ field can have the following expression: `material_translation__vr.title__v`
    2. [Add](/en/lr/26387/#how-to-edit-related-object-columns) the fields you created as default columns in the _HACCP Plan Materials_ section.

When users add materials to a _HACCP Plan_ from the _HACCP Plan Materials_ section, the record selection dialog displays translated records in the same language as the target _HACCP Plan_.

## Displaying Translated Master Data on the HACCP Flow Diagram {#hfd}

Vault automatically displays available translated field data for all [standard master data objects](/en/lr/771989/#translate) and any [configured custom master data objects][4] on the HACCP Flow Diagram's canvas, _Information_ panel, and record selection dialogs.

## Configuring Translated Reference Constraints {#field-criteria}

If you have [reference constraints](/en/lr/75340/) configured on transactional objects to filter the related master data records that users can select, you must create _HACCP Translated Field Criteria_ records to ensure Vault filters the translated records properly.

Before creating a _HACCP Translated Field Criteria_ record, you must add a [_Lookup_ field](/en/lr/34072/) to the target translation companion object referencing the object relationship and field that the criteria VQL uses.

<a href="https://platform.veevavault.help/assets/images/cp-qms-lookup.png" data-lightbox="cp-qms-lookup.png" data-title="" data-alt="Lookup field example configuration">
  <img class="docimage" src="https://platform.veevavault.help/assets/images/cp-qms-lookup.png" alt="Lookup field example configuration" style="max-width: 80%;"  />
</a>

To ensure Vault can filter translated records properly, review the [limitations on criteria VQL][11] before you begin.

To create _HACCP Translated Field Criteria_:

1. Navigate to **Admin > Configuration > Application Configurations > Component Setup > HACCP Translated Field Criteria**.
2. Click **Create**.
3. Enter a **Name**.
4. Select a **Transactional Object**.
5. Enter the **Object field using criteria** in the following format: `Field.[object_field_name__v]`. For example, `Field.facility__v`. This must be a field on the object for which you are creating the related object section and its translation companion object.
6. Enter the **Criteria for the translated field**.
7. Click **Save**.

<a href="https://platform.veevavault.help/assets/images/cp-qms-field-criteria.png" data-lightbox="cp-qms-field-criteria.png" data-title="" data-alt="HACCP Translated Field Criteria example configuration">
  <img class="docimage" src="https://platform.veevavault.help/assets/images/cp-qms-field-criteria.png" alt="HACCP Translated Field Criteria example configuration" style="max-width: 80%;"  />
</a>

### Limitations on Translated Criteria VQL {#vql-limitations}

In addition to the [Platform-level limitations](/en/lr/75340/#limitations) affecting static and dynamic reference constraints, the following limitations apply to criteria VQL in reference constraints for translated records:

* You can configure criteria VQL only on object reference fields. Document reference fields are not supported.
* Only object reference fields and single-value picklist fields are supported as controlling fields in dynamic reference constraints.
* [Tokens](/en/lr/6382/) in criteria VQL statements must be in one of the following formats:
    * `{{this.field_name}}`
    * `{{this.relationship_name.field_name}}`
    * `{{this.object_type_name__vr.field_name__v}}`
* [Functions](/en/lr/52324/) are not supported. For instance, the following function is not supported: `{{IN_LAST(numberOfDays)}`

## Configuring User Permissions {#permissions}

To use HACCP Plan Translation, users must have a security profile with a permission set that grants the following permissions:

* All [standard HACCP permissions](/en/lr/492247/#user-permission).
* _Edit_ permission for the _HACCP Translation Generation_ object.
* _Create_, _Edit_, and _Delete_ permissions on all [standard][14] and [custom][4] master data objects and their corresponding translation companion objects. 
* _Create_, _Edit_, and _Delete_ permissions for all [transactional objects][5] included in the HACCP copy actions.
* _Edit_ permission for translatable fields and object reference fields on HACCP transactional objects.
* _Execute_ permission on the _HACCP Plan_ object for the following object actions:
    * _Export Translatable Fields_
    * _Generate Translation Copy_
    * _Import Translatable Fields_
* To view translated field data in _Details_ sections, users must have _View_ permission for the _Translated Field_ object control on the following objects:
  * _CCP-Hazard Analysis_
  * _HACCP Hazard Control_
  * _HACCP Plan Process Step_
  * _Process Hazard Analysis_
* To add and display translated _Materials_ on a _HACCP Plan_, users must have the following permissions:
    * _View_ permission for the _HACCP Plan Materials_ object control on the _HACCP Plan_ object
    * _Read_ permission on the _HACCP Plan Material_ object

[1]: #terminology
[2]: #objects
[3]: #user-actions
[4]: #define-custom-objects
[5]: #copy-custom-objects
[6]: #details-section
[7]: #related-object-section
[8]: #hfd
[9]: #field-criteria
[10]: #permissions
[11]: #vql-limitations
[12]: #master-data-layouts
[13]: #materials-section
[14]: #standard-md