Create a Document AI Schema Configuration
Learning Objectives
After completing this unit, you’ll be able to:
- Explain the parts of a Document AI schema configuration.
- Create a Document AI schema configuration.
How Document AI Works
Document AI works based on a schema configuration and LLM models. In a schema configuration, you define what fields to pull from the document, prompt instructions on how to find and format the fields, and which model to use. The configuration is then passed to the LLM so the LLM can process the document and extract data based on the prompts.
Let’s compare examples of ineffective and effective prompt instructions for the order_date field.
Ineffective | Effective | |
|---|---|---|
Prompt | “Find the date on the PO.” | “Date the PO was issued or signed. Return in YYYY-MM-DD format.” |
Explanation | This prompt doesn’t specify which date to find. There might be multiple dates on the PO. It also doesn’t specify the format. | This prompt specifies which dates are acceptable. It also specifies the format. |
Source Object Versus Without Source Object
You can create a schema configuration with or without a source object. Your best option depends on where your unstructured data is and what your desired output is.
With Source Object | Without Source Object | |
|---|---|---|
Where data resides | Data is already ingested into Data 360 and resides in an unstructured data model object (UDMO). | Data currently resides outside of Data 360. You’ll upload files directly to Salesforce (such as to an Opportunity record). |
Output | Automatically updates DLOs and DMOs. | Returns data into a flow, Apex, or API response. |
Since you want to provide the data directly to a flow that updates the opportunity record, you create a configuration without a source object.
Create a Document AI Schema Configuration
- Locate and click the App Launcher, the grid icon in the top left corner.
- Search for and select Data Cloud.
- Click Process & Enrich, then click Document AI.
- Click New.
- Click Without a source object, then click Next.
- Download this PO file.
- Click Upload Files, choose the PO file, click Open, and click Done.
- From the model dropdown, select Gemini 3.5 Flash.
- Click Create Manually, then click Next.
- Click + Add Field
- For the Field Name, enter
po_number. Make sure the API Name is also po_number. - Leave the default String Field Type.
- For the Prompt Instructions, enter
Purchase Order number or reference ID. - Click Add.
- Repeat steps 10-14 four more times to add all the fields below.
Field Name and API Name | Field Type (all are default String) | Prompt Instructions |
|---|---|---|
order_date | String | Date the PO was issued or signed. Return in YYYY-MM-DD format. |
total_amount | String | Total order value including all taxes and fees. Return as a numeric value only, no currency symbols. |
payment_terms | String | Payment terms stated on the PO (for example, Net 30, Net 60). |
line_item_summary | String | One-sentence summary of the goods or services ordered. |
- Click Test. Verify all 5 fields come back correctly.
- po_number = BFL/PO/2025-26/00412
- order_date = 2026-03-15
- total_amount = 58300
- payment_terms = Net 45
- line_item_summary = Purchase of Data Integration Tool Premium Edition, Document Processing Tool Add-On, and Premier Success Planning.
- po_number = BFL/PO/2025-26/00412
- Click Save Draft.
- For the Document Schema Name, enter
po_config. Make sure the API name is also po_config. - Click Save.
Now you have a schema configuration that can extract data from a PO. Next, create Apex classes.