# Configuring Audit Report Printable View (HSE, QMS)

<!--QMS Audit Management Admin section-->
<!--Source File-->



<a href="/en/gr/78610/">QualityOne Vaults</a> enable users to <a href="/en/gr/824756/">generate a printable view of information in an Audit</a>, including all audit checklists, _Audit Findings_, and supporting images from the _Audit_. Users can download and save the view as a printable PDF file, enabling your organization to collate and organize audit data in a user-friendly format.

## Configuration Overview {#overview}

Configuring your Vault to use audit report printable views involves the following steps:

1. [Create an XML Configuration][1]
2. [Create an Audit Report Configuration][2]
3. [Configure the _Generate Audit Report Printable View_ action][3]
4. [Configure user permissions][4]

<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>



## Creating an XML Configuration {#create-xml}

You must create an XML configuration to define the data order and format of the view, including the related object records that will appear in the printable view, the fields that will display, as well as the format: table or two-column.

### XML Configuration Structure {#xml-structure}

The [example XML configuration][5] below includes all basic information structures available for printable views. The XML structure includes these basic element sections:

* A required top-level `<vault:page xmins:vault="VeevaVault">` element that contains all configuration data
* An optional element that sets the page title of the printable view
* Data from the target _Audit_ record
* Data from related objects, such as _Audit Finding_, _Organization_, and any custom objects configured in your Vault
* Data from the _Team_ section of the _Audit_ record

### Page Title {#title}

You can optionally define the title of the printable view using the `<vault:pageTitle>` element. Titles cannot exceed 255 characters. You can optionally specify a font size using the `fontSize` attribute. Font size defaults to 24px if this attribute is not defined.

### Audit Data Section {#audit-section}

You can display data from an _Audit_ record in the printable view with the `<vault:section>` element. When configured on the _Audit_ object, the element has the following attributes:

* `type`: The value of this required attribute must be `TARGET_OBJECT`.
* `title`: Optionally define a title to display above the section. Titles cannot exceed 255 characters.
* `object`: The target object of this required attribute must be _Audit_ (`audit__qdm`). 
* `hide`: Setting the value of this optional attribute to `true` hides this section.

### Related Object Data Section {#ro-section}

You can optionally use the `<vault:section>` attribute to display data from an object related to the _Audit_ object. You can define the following attributes for this section type:

* `type`: The value of this required attribute must be `RELATED_OBJECT`.
* `title`: Optionally define a title to display above the section. Titles cannot exceed 255 characters.
* `object`: The related object. 
* `hide`: Setting the value of this optional attribute to `true` hides this section.
* `objectType`: Optionally define the object type for the section.
* `relationship`: The value of this required attribute must specify the name of the relationship between the related object and the _Audit_ object.
* `embeddedImages`: Optionally specify if an _Audit Findings_ related object section contains images. 

### Team Data Section {#team-section}

You can optionally use the `<vault:section>` attribute to display Team information associated with the target _Audit_, such as _Team Roles_ and _Team Role_ membership. The following attributes are available for this section type:

* `type`: The value of this required attribute must be `TEAM`.
* `title`: Optionally define a title to display above the section. Titles cannot exceed 255 characters.
* `hide`: Setting the value of this optional attribute to `true` hides this section.

### Description {#description}

You can include an optional `<vault:description>` element to display a description in any type of section. Descriptions cannot exceed 1500 characters.

### Object Detail Layouts {#object-detail}

The `<vault:objectDetail>` element displays field data within target or related object data sections. This element contains an optional `layout` attribute that determines how Vault displays data in that section. The following values are available for this attribute:

* `Two-Columns`: A two-column block that displays the field name and corresponding data. This layout option works well for multiple short- to medium-length fields. If the `layout` attribute is not defined, data displays in a two-column layout.
* `Table`: A standard table format. Each column in the table displays data from one (1) field. This layout option works well for sections with multiple data entries, such as the _Audit Finding_ section. For an optimal user experience, we recommend including up to five (5) columns per table.

### Field Data {#field-data}

Within `<vault:objectDetail>` elements in target and related object sections, you can list out the field data with the `<vault:field>` element, using the following attributes:

* `name`: The value of this required attribute must contain the name of a field you wish to display in the report.
* `relationship`: This optional attribute contains the name of the outbound relationship of the target or related object to another object. Include this attribute to display field data from an object record referenced on the target or related object record. The relationship referenced in this attribute must be defined in the list of outbound relationships on the target or related object for which you are configuring the section.
* `hyperlink`: This optional attribute specifies if the field should be a clickable link to an object record in Vault.

### Example XML Configuration {#example-xml}

Consider the following example XML configuration that you can copy and customize to create a configuration for your organization. 

```
<vault:page xmlns:vault="VeevaVault">
<vault:pageTitle fontSize="24">CORPORATE QUALITY AUDIT REPORT</vault:pageTitle>
<vault:section type="TARGET_OBJECT" title="Audit Details" object="audit__qdm" hide="false">
       <vault:objectDetail layout="Two-Column">
          <vault:field name="name__v"  hyperlink="true"/>
          <vault:field name="title__v" />       
          <vault:field name="audit_criteria__qdm" /> 
          <vault:field name="state__v" />
       </vault:objectDetail>
</vault:section>
<vault:section type="TARGET_OBJECT" title="Audit Dates" object="audit__qdm">
       <vault:objectDetail layout="Two-Column">
          <vault:field name="scheduled_start_date__qdm" />
          <vault:field name="scheduled_end_date__qdm" />
          <vault:field name="actual_start_date__qdm" />
          <vault:field name="actual_end_date__qdm" />  
       </vault:objectDetail>
</vault:section>
<vault:section type="TARGET_OBJECT" title="Facility Information" object="audit__qdm">
       <vault:objectDetail layout="Two-Column">
          <vault:field relationship="facility__vr" name="name__v" /> 
          <vault:field relationship="facility__vr" name="number__v" /> 
          <vault:field relationship="facility__vr" name="address__v" /> 
          <vault:field relationship="facility__vr" name="risk_classification__v" /> 
       </vault:objectDetail>
</vault:section>
<vault:section type="TEAM" title="Audit Team">
       <vault:objectDetail layout="Two-Column" />
</vault:section>
<vault:section type="RELATED_OBJECT" title="Finding Summary" object="audit_finding__v" relationship="audit__vr" embeddedImages="true">
<vault:description>All findings identified during the audit are captured within the table below: </vault:description>
       <vault:objectDetail layout="Table">
          <vault:field name="name__v" hyperlink="true" />
          <vault:field name="title__v" />
          <vault:field name="finding_type__v" />
          <vault:field relationship="department__vr" name="name__v" />
       </vault:objectDetail>
</vault:section>
</vault:page>
```

## Creating an Audit Report Configuration {#audit-report-config}

Once all respondents have completed their assigned checklists, the lead auditor can generate a printable view including all checklists, audit findings, and any images added to audit findings from an _Audit_. Auditors can download, save, and print a PDF file of the printable view.

You must create Audit Report Configuration (`auditreportconfiguration`) component records to define how the audit report displays and the information included in the report.

To create an Audit Report Configuration:

1. Navigate to **Admin > Configuration > Application Configurations > Audit Report Configuration**.
2. Click **Create**.
3. Enter a **Label**.
4. Enter a **Name**.
5. Upload a **Header Logo**. _Header Logo_ images are scaled down to fit into a 100px x 100px container. The image's file size cannot exceed 10 MB and must be in one (1) of the following formats:
    * BMP
    * HEIF (*.heic, *.heif)
    * GIF
    * JPEG (*.jpeg, *.jpg)
    * PNG
    * SVG
    * TIFF
6. Enter the **XML Configuration**. See the guidelines for [authoring an XML configuration][5].
7. Click **Save**.

## Configuring the Generate Audit Report Printable View Action {#action}

You can configure the _Generate Audit Report Printable View_ action on the _Audit_ object to allow users to generate a printable view containing all checklists, audit findings, and supporting images in an audit. Before configuring the action, you must first <a href="/en/gr/43127/#assigning-actions-to-an-object">assign</a> the action to the _Audit_ object and [create an Audit Report Configuration][2]. After these steps have been completed, configure the _Generate Audit Report Printable View_ <a href="/en/gr/59885/#how-to-define-a-user-action">user action</a> on any state of the _Audit Lifecycle_ or any other lifecycle configured for the _Audit_ object.

If you have more than one (1) Audit Report Configuration, you can configure more than one (1) user action to generate different types of Audit Reports. Ensure you differentiate the actions to generate different Audit Reports by clearly labelling them.

## Limitations {#limitations}

The following limitations apply to audit report printable views:

* The XML Configuration cannot exceed 32,000 characters.
* The following limits apply to printable view section configurations:
    * A maximum of 15 target object sections
    * A maximum of 15 related object sections
    * A maximum of 25 related and target object sections combined
    * A maximum of one (1) _Team_ section
* The `embeddedImages` attribute is supported only for _Audit Findings_ related object sections.
* For related objects to be supported on the Audit Report, they must have an <a href="/en/gr/28740/#how-to-view-relationships">outbound relationship</a> to the _Audit_ object. Inbound relationships are not supported.
* When the `relationship` attribute is used on the fields in target or related object sections as part of the `<vault:field>` element, the referenced relationship must be defined in the list of outbound relationships on the target or related object. Inbound relationships are not supported.
* _Currency_ type fields are not supported for inclusion in the audit report printable view.

## Configuring User Permissions {#user-permissions}

You must ensure users have the appropriate read <a href="/en/gr/22824/">permissions</a> to access the appropriate objects and object fields in addition to the permissions outlined below:

* _Read_ permission on the following objects:
    * _Audit_
    * _Audit Checklist_
    * _Audit Finding_
    * Any related objects included or referenced in the audit report

## Related Permissions {#related-permissions}

You can complete all the steps in this article with the standard _System Administrator_ or _Vault Owner_ security profile. If your Vault uses custom security profiles, your profile must grant the following <a href="/en/gr/22824/">permissions</a>:

<table>
  <tr>
   <td><strong>Type</strong>
   </td>
   <td><strong>Permission</strong>
   </td>
   <td><strong>Controls</strong>
   </td>
  </tr>
  <tr>
   <td>Security Profile
   </td>
   <td>Admin: Configuration: Object Lifecycles: Edit
   </td>
   <td>Ability to modify lifecycles.
   </td>
  </tr>
  <tr>
   <td>Security Profile
   </td>
   <td>Admin: Configuration: Objects: Edit
   </td>
   <td>Ability to modify Vault objects.
   </td>
  </tr>
  <tr>
   <td>Security Profile
   </td>
   <td>Pages: All Pages: Audit Report Page: View
   </td>
   <td>Ability to view Audit Report Configurations.
   </td>
  </tr>
</table>

[1]: #create-xml
[2]: #audit-report-config
[3]: #action
[4]: #user-permissions
[5]: #example-xml