Overview
In this tutorial, you will build a CloudFiles Document AI workflow that keeps a student's admission checklist up to date. Each time a file is uploaded to a Student record, a record-triggered flow sends it to the workflow, which:
- Classifies the file as one of the required admission documents, or as something else.
- Finds the matching row on the Student's Document Checklist.
- Marks that row as submitted, with the upload date.

The tutorial tracks five admission documents: Passport, High School Transcript, High School Diploma, English Test Score Report and Recommendation Letter. Swap in the documents your process needs; the steps stay the same.
Pre-requisites
Before you start, make sure that:
- CloudFiles Document AI is installed and connected, with an active subscription or trial.
- The CloudFiles Event Mode setting is set to Custom Object, so that uploads create CloudFiles Event records a flow can trigger on.
- Your org has a Student object and a Document Checklist object below it, with one checklist row per required document.

This tutorial uses these fields on Document Checklist:
| Field | Type | Purpose |
|---|---|---|
| Student | Master-Detail (Student) | The Student the row belongs to |
| Document Type | Picklist | The required document: Passport, High School Transcript, High School Diploma, English Test Score Report, Recommendation Letter |
| Submitted | Checkbox | Ticked when a matching document is uploaded |
| Upload Date | Date | The day the document arrived |

Build the Workflow
The workflow does the classifying and the updating. Open the CloudFiles app, click the Document AI tab and choose Workflows. For everything a workflow can do, see Workflows.
Create the Workflow and its Launch Form
Click New workflow, name it Document Checklist and leave the review policy on Straight through, so the checklist is updated without a person approving each run. Under When this runs, it starts with, rename the document slot to uploaded_file and keep One document. Then click Add a field, name it student_id, keep the type Text and Required, and give it the label Student Id. The Salesforce flow fills both.

Classify the Document
Click Add the first step and choose Classify. Name the step Classify the document and enter the labels Passport, High School Transcript, High School Diploma, English Test Score Report, Recommendation Letter, Other.

Spell each label exactly like its Document Type picklist value. The next step looks up the checklist row by comparing the two, so a label that differs by a letter finds nothing.
Skip Other Documents
Add a Decision step named Skip other documents. Click Add branch, set the left value to the ai_classify_1.category chip, keep equals, type Other and leave then go to on End run. Every other file takes the no-match route to the next step.

Find the Checklist Row
On the no-match path, add Find a Salesforce record named Find the checklist row and choose the Document Checklist object. Keep All conditions (AND) and add two conditions:
| Field | Operator | Value |
|---|---|---|
| Student | equals | the trigger.student_id chip |
| Document Type | equals | the ai_classify_1.category chip |
Keep Only the first record. One step with two conditions finds the right row for every document type, so the workflow needs no branch per type.

Check the Row Exists
Add a Decision named Is it on the checklist?. Add a branch with the left value sf_getRecords_1.outcome, equals and MATCHED, and leave the no-match route on End run. A Student without a row for that document type then ends cleanly instead of failing on the update.

Mark it Submitted
On the branch_1 path, add Update Salesforce record named Mark it submitted. Choose Document Checklist, set Record to update to the sf_getRecords_1.record.Id chip, and add two fields. Both values come from Global values under Values you can use here.
| Field | Value |
|---|---|
| Submitted | the True chip |
| Upload Date | the Today chip |

Always insert a value by clicking its chip. A reference typed by hand with a typo is saved as plain text, and the step then writes that text instead of the value.
The finished workflow looks like this.

Test and Publish the Workflow
Click Test run, upload a sample document, enter the Id of a test Student and click Start run. A test run writes to Salesforce exactly as a real run does, so use a Student you can change. The run shows what each step produced, with a confidence score for the classification. When the results look right, click Publish v1.

Then go back to the Workflows list and click the Copy workflow ID icon in the Run column. The Salesforce flow uses this id to start the workflow.

The flow needs the workflow ID from the Copy workflow ID icon. The Config API Name in the same list is used for moving configurations between orgs and is not accepted as a Workflow Id.
Start the Workflow from a Salesforce Flow
A record-triggered flow starts the workflow with the CloudFiles: Run Doc AI Workflow action whenever a file is uploaded to a Student. It listens for the Salesforce File Attached event, which CloudFiles records on the CloudFiles Event object whenever a file is attached to a record in Salesforce Files. The finished flow has four elements.

Configure the Trigger
Create a Record-Triggered Flow on the CloudFiles Event object, triggered when A record is created and optimized for Actions and Related Records. Add two entry conditions: Type equals salesforce-file-attached and Object Type equals Student__c, the Student object's API name. Add a Run Asynchronously path and build everything below on it, because the workflow action makes an external callout that a record-triggered flow cannot make on the path that runs immediately.

Get the Event Details and the Uploaded File
Add the CloudFiles: Get Event Details action with the triggering CloudFiles Event record as its input. Then add a Get Records element named Get the uploaded file on Content Document, with the condition Content Document ID In Outputs from Get event details > SalesforceFiles > ContentDocumentIds, storing only the first record.

Prepare the Workflow Inputs
Create five Apex-defined variables: Resource of class cldfs__Resource, slotBinding and SlotBindings of class cldfs__DocumentSlotBinding, and FieldValue_Single and FieldValue_Collection of class cldfs__FieldValue. Tick Allow multiple values on SlotBindings and FieldValue_Collection. Then add one Assignment with these rows, in this order.
| Variable | Operator | Value |
|---|---|---|
| Resource > library | Equals | salesforce |
| Resource > id | Equals | Content Document from Get the uploaded file > Content Document ID |
| slotBinding > resource | Equals | Resource |
| slotBinding > slot | Equals | uploaded_file |
| SlotBindings | Add | slotBinding |
| FieldValue_Single > name | Equals | student_id |
| FieldValue_Single > value | Equals | Outputs from Get event details > SalesforceFiles > ParentId |
| FieldValue_Collection | Add | FieldValue_Single |

The slot name and the field name must match the names declared in the workflow exactly.
Run the Workflow
Add the CloudFiles: Run Doc AI Workflow action. Set Documents to {!SlotBindings}, Fields to {!FieldValue_Collection}, Record Id to Outputs from Get event details > SalesforceFiles > ParentId, and Workflow Id to the id you copied. Save the flow and activate it.

The action returns as soon as the run is accepted, and the workflow updates the checklist on its own a few seconds later. The flow does not receive the workflow's results.
Check the Run on the Doc AI Run Object
Every run started from a flow is recorded on the CloudFiles Doc AI Run object. Open the CloudFiles DocAI Runs tab and choose the All Runs list view to see each run with its status. A run reads Completed when the workflow finished and Failed when it could not.
Open a run to see its status, the Student it ran for in Parent Record Id, the document it started with, which checklist row it updated and what each step produced, with confidence scores.

See it in Action
Open a Student and upload a document from the Files related list. Wait a few seconds and refresh the page: the matching row on the Document Checklist is ticked, with today's date. Each document marks only its own row.

Note: Flow executions and AI runs take a few seconds, so the checklist does not update immediately. Wait briefly and refresh.
Congratulations! You have built an AI-powered document checklist with a CloudFiles Document AI workflow and a Salesforce flow.