---
schema_version: "1"
id: 26bb04d66dbeae5140d44d181b7eb7444955eddedb7f2653061192820d7d534c
title: OcrTemplate
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_ocrtemplate.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_ocrtemplate.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 839eaeb52d8ae5834ff355c2a0ae34279357db4dd8851fbf384099f5e2ca9057
description: Represents the details of the mapping between a form and a Salesforce object using Intelligent Form Reader. This type extends the Metadata metadata type and inherits its fullName field.
---
# OcrTemplate

Represents the details of the mapping between a form and a Salesforce object using Intelligent Form Reader. This type extends the Metadata metadata type and inherits its fullName field.

![Important](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note_important.png)

#### Important

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

## File Suffix and Directory Location

OcrTemplate components have the suffix .ocrTemplate and are stored in the ocrTemplates folder.

## Version

OcrTemplate components are available in API version 52.0 and later.

## Special Access Rules

To use this metadata type, your Salesforce org must have the AWSTextract1000LimitAddOn license.

## Fields

| Field Name | Field Type | Description |
| --- | --- | --- |
| active | boolean | Indicates whether the OCR template is active (true) or not (false). |
| description | string | The description of the OCR template. |
| documentType | string | Required. The document type for which this template defines mappings. |
| masterLabel | string | Required. The label for the OCR template. |
| ocrTargetObjects | [OcrTargetObject](#OcrTargettObj)\[\] | Represents the details of the object to which information from a form is extracted and mapped. |
| ocrTemplateSampleDocuments | [OcrTemplateSampleDocument](#OcrTemplateSampleDoc)\[\] | Represents the details of a sample document or a document type that's used as a reference while extracting and mapping information from a customer form. |
| pageCount | integer | The number of pages in the form from which information is extracted. |
| templateName | string | Required. The name of the OCR template. |

## OcrTargetObject

Represents the details of the object to which information from a form is extracted and mapped.

Table 1. Fields
| Field Name | Field Type | Description |
| --- | --- | --- |
| ocrTargetObjFieldMappings | [OcrTargetObjFieldMapping](#OcrTgtObjFieldMap)\[\] | Represents the details of how information from a form field is mapped to fields in an object. |
| targetObject | string | Required. The object to which information from a form is mapped. |
| targetObjectRecordType | string | The developer name of the record type of the target object. Available in API version 56.0 and later. |

## OcrTargetObjFieldMapping

Represents the details of how information from a form field is mapped to fields in an object.

<table class="featureTable sort_table" summary="">
          <caption><span class="tablecap">Table 2. Fields</span></caption>



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d712885e346">Field Name</th>

              <th class="featureTableHeader  " id="d712885e349">Field Type</th>

              <th class="featureTableHeader  " id="d712885e352">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d712885e346" data-title="Field Name"><span class="keyword parmname">ocrSampleDocField</span></td>

              <td class="entry" headers="d712885e349" data-title="Field Type">
                <a class="xref" href="#OcrSampleDocField">OcrSampleDocumentField</a>[]
              </td>

              <td class="entry" headers="d712885e352" data-title="Description">The details of the field in a form whose value is extracted and mapped to a
                Salesforce object field.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e346" data-title="Field Name"><span class="keyword parmname">targetField</span></td>

              <td class="entry" headers="d712885e349" data-title="Field Type">string</td>

              <td class="entry" headers="d712885e352" data-title="Description">Required. The field to which information is mapped.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e346" data-title="Field Name"><span class="keyword parmname">type</span></td>

              <td class="entry" headers="d712885e349" data-title="Field Type">OcrMappingType (enumeration of type string)</td>

              <td class="entry" headers="d712885e352" data-title="Description">Required. Specifies the type of mapping. Available in API version 56.0 and
                later.<p class="p">Valid values are:</p>
                <ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">FormField</samp></li>

                  <li class="li"><samp class="codeph nolang">TableColumn</samp></li>

                </ul>
                The default value is <samp class="codeph nolang">FormField</samp>.
              </td>

            </tr>

          </tbody>

        </table>

## OcrSampleDocumentField

Represents the details of the field in a form whose value is extracted and mapped to a Salesforce object field.

<table class="featureTable sort_table" summary="">
          <caption><span class="tablecap">Table 3. Fields</span></caption>



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d712885e447">Field Name</th>

              <th class="featureTableHeader  " id="d712885e450">Field Type</th>

              <th class="featureTableHeader  " id="d712885e453">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d712885e447" data-title="Field Name"><span class="keyword parmname">cellColumnNumber</span></td>

              <td class="entry" headers="d712885e450" data-title="Field Type">int</td>

              <td class="entry" headers="d712885e453" data-title="Description">The column number in the item with the cell storing this field’s value.
                Available in API version 56.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e447" data-title="Field Name"><span class="keyword parmname">cellColumnSpanValue</span></td>

              <td class="entry" headers="d712885e450" data-title="Field Type">int</td>

              <td class="entry" headers="d712885e453" data-title="Description">The number of columns that span the cell storing this field’s value. Available
                in API version 56.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e447" data-title="Field Name"><span class="keyword parmname">cellRowNumber</span></td>

              <td class="entry" headers="d712885e450" data-title="Field Type">int</td>

              <td class="entry" headers="d712885e453" data-title="Description">The row number in the item with the cell storing this field’s value. Available
                in API version 56.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e447" data-title="Field Name"><span class="keyword parmname">cellRowSpanValue</span></td>

              <td class="entry" headers="d712885e450" data-title="Field Type">int</td>

              <td class="entry" headers="d712885e453" data-title="Description">The number of rows that span the cell storing this field’s value. Available in
                API version 56.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e447" data-title="Field Name"><span class="keyword parmname">fieldLabelMaxX</span></td>

              <td class="entry" headers="d712885e450" data-title="Field Type">double</td>

              <td class="entry" headers="d712885e453" data-title="Description">A normalized coordinate representing the right edge of the bounding box of the
                key.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e447" data-title="Field Name"><span class="keyword parmname">fieldLabelMaxY</span></td>

              <td class="entry" headers="d712885e450" data-title="Field Type">double</td>

              <td class="entry" headers="d712885e453" data-title="Description">A normalized coordinate representing the bottom edge of the bounding box of the
                key.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e447" data-title="Field Name"><span class="keyword parmname">fieldLabelMinX</span></td>

              <td class="entry" headers="d712885e450" data-title="Field Type">double</td>

              <td class="entry" headers="d712885e453" data-title="Description">A normalized coordinate representing the left edge of the bounding box of the
                key.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e447" data-title="Field Name"><span class="keyword parmname">fieldLabelMinY</span></td>

              <td class="entry" headers="d712885e450" data-title="Field Type">double</td>

              <td class="entry" headers="d712885e453" data-title="Description">A normalized coordinate representing the top edge of the bounding box of the
                key.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e447" data-title="Field Name"><span class="keyword parmname">fieldValueName</span></td>

              <td class="entry" headers="d712885e450" data-title="Field Type">string</td>

              <td class="entry" headers="d712885e453" data-title="Description">The name of the referred field value. Available in API version 56.0 and
                later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e447" data-title="Field Name"><span class="keyword parmname">isAutoExtractedValue</span></td>

              <td class="entry" headers="d712885e450" data-title="Field Type">boolean</td>

              <td class="entry" headers="d712885e453" data-title="Description">Indicates whether the key is automatically extracted (<samp class="codeph nolang">true</samp>) or not (<samp class="codeph nolang">false</samp>). Available in API version 57.0 and later.<p class="p">This field helps to
                  distinguish auto-extracted keys from manual ones.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e447" data-title="Field Name"><span class="keyword parmname">keyContent</span></td>

              <td class="entry" headers="d712885e450" data-title="Field Type">string</td>

              <td class="entry" headers="d712885e453" data-title="Description"> The content in a particular area of the form, representing the field that is
                extracted by OCR.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e447" data-title="Field Name"><span class="keyword parmname">ocrSampleDocument</span></td>

              <td class="entry" headers="d712885e450" data-title="Field Type">string</td>

              <td class="entry" headers="d712885e453" data-title="Description">Required. The associated OCR sample document is used as a reference while
                extracting and mapping information from a customer form.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e447" data-title="Field Name"><span class="keyword parmname">ocrSampleDocumentPage</span></td>

              <td class="entry" headers="d712885e450" data-title="Field Type">string</td>

              <td class="entry" headers="d712885e453" data-title="Description">A collection of fields that define a page in the OCR sample document.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e447" data-title="Field Name"><span class="keyword parmname">ocrSampleDocumentPageItem</span></td>

              <td class="entry" headers="d712885e450" data-title="Field Type"><a class="xref" href="#" title="Represents the details of the mapping between a form and a Salesforce object using Intelligent Form Reader. This type extends the Metadata metadata type and inherits its fullName field.">OcrSampleDocumentPageItem</a></td>

              <td class="entry" headers="d712885e453" data-title="Description">A reference to the item on the sample document page containing this field's
                value. Available in API version 56.0 and later.</td>

            </tr>

          </tbody>

        </table>

## OcrSampleDocumentPageItem

Represents a foreign key reference to the item on the sample document page containing a value for the page item.

<table class="featureTable sort_table" summary="">
          <caption><span class="tablecap">Table 4. Fields</span></caption>



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d712885e692">Field Name</th>

              <th class="featureTableHeader  " id="d712885e695">Field Type</th>

              <th class="featureTableHeader  " id="d712885e698">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d712885e692" data-title="Field Name"><span class="keyword parmname">hasHeader</span></td>

              <td class="entry" headers="d712885e695" data-title="Field Type">boolean</td>

              <td class="entry" headers="d712885e698" data-title="Description">Indicates whether the OCR sample document page item has a header (<samp class="codeph nolang">true</samp>) or not (<samp class="codeph nolang">false</samp>). The default value is <samp class="codeph nolang">false</samp>.
                Available in API version 56.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e692" data-title="Field Name"><span class="keyword parmname">sequenceNumber</span></td>

              <td class="entry" headers="d712885e695" data-title="Field Type">int</td>

              <td class="entry" headers="d712885e698" data-title="Description">Required. The sequence number of the item on an OCR sample document page with
                multiple items. Available in API version 56.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e692" data-title="Field Name"><span class="keyword parmname">title</span></td>

              <td class="entry" headers="d712885e695" data-title="Field Type">string</td>

              <td class="entry" headers="d712885e698" data-title="Description">The title of the OCR sample document page item. Available in API version 56.0
                and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d712885e692" data-title="Field Name"><span class="keyword parmname">type</span></td>

              <td class="entry" headers="d712885e695" data-title="Field Type">ItemType (enumeration of type string)</td>

              <td class="entry" headers="d712885e698" data-title="Description">Required. Specifies the type of OCR sample document page item. <p class="p">Valid value
                  is <samp class="codeph nolang">TABLE</samp>.</p>
                Available in API version 56.0
                and later.</td>

            </tr>

          </tbody>

        </table>

## OcrTemplateSampleDocument

Represents the details of a sample document or a document type that's used as a reference while extracting and mapping information from a customer form.

Table 5. Fields
| Field Name | Field Type | Description |
| --- | --- | --- |
| ocrSampleDocument | string | The associated OCR sample document is used as a reference while extracting and mapping information from a customer form. |

## Declarative Metadata Sample Definition

The following is an example of a OcrTemplate component.

<?xml version="1.0" encoding="UTF-8"?>
<OcrTemplate xmlns="http://soap.sforce.com/2006/04/metadata">
   <active\>false</active\>
   <documentType\>Form</documentType\>
   <masterLabel\>Form Test 222</masterLabel\>
   <ocrTargetObjects\>
      <ocrTargetObjFieldMappings\>
         <ocrSampleDocField\>
            <cellColumnNumber\>1</cellColumnNumber\>
            <cellColumnSpanValue\>1</cellColumnSpanValue\>
            <cellRowNumber\>1</cellRowNumber\>
            <cellRowSpanValue\>1</cellRowSpanValue\>
             <fieldLabelMaxX\>0.5975854</fieldLabelMaxX\>
             <fieldLabelMaxY\>0.46625894</fieldLabelMaxY\>
             <fieldLabelMinX\>0.5065626</fieldLabelMinX\>
             <fieldLabelMinY\>0.39605626</fieldLabelMinY\>
             <keyContent\>Last Name</keyContent\>
             <ocrSampleDocument\>image240</ocrSampleDocument\>
             <ocrSampleDocumentPage\>1</ocrSampleDocumentPage\>
             <ocrSampleDocumentPageItem\>
                <hasHeader\>false</hasHeader\>
                <sequenceNumber\>1</sequenceNumber\>
                <title\>Table1</title\>
                <type\>TABLE</type\>
            </ocrSampleDocumentPageItem\>
        </ocrSampleDocField\>
      <targetField\>Account.Name</targetField\>
      <type\>TableColumn</type\>
      </ocrTargetObjFieldMappings\>
      <targetObject\>Account</targetObject\>
      <targetObjectRecordType\>Account.X240</targetObjectRecordType\>
   </ocrTargetObjects\>
   <ocrTemplateSampleDocuments\>
      <ocrSampleDocument\>Form</ocrSampleDocument\>
   </ocrTemplateSampleDocuments\>
   <pageCount\>10</pageCount\>
   <templateName\>Form Test</templateName\>
</OcrTemplate\>

The following is an example package.xml that references the previous definition.

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
   <types\>
      <members\>\*</members\>
      <name\>OcrTemplate</name\>
   </types\>
   <version\>68.0</version\>
</Package\>

## Wildcard Support in the Manifest File

This metadata type supports the wildcard character \* (asterisk) in the package.xml manifest file. For information about using the manifest file, see [Deploying and Retrieving Metadata with the Zip File](https://developer.salesforce.com/docs/atlas.en-us.264.0.api_meta.meta/api_meta/file_based_zip_file.htm).