Automating partner proof-of-completion validation
Partner management keeps running into the same job: somebody has to check a proof-of-completion document, usually a PDF, before a rebate claim gets processed. Partners submit files with the date, the amount, the quantity or the product missing. Leaving that to an internal team after submission is slow and it costs money.
Limitations of a custom LWC approach
A custom Lightning Web Component can take the file upload and hand it to Apex for parsing somewhere external. It also hands your development team the UI, the file handling, the error management and the Experience Cloud permissions to own. For this particular use case that is more than the job needs.
Using Screen Flow for file uploads
The File Upload screen component inside a Screen Flow covers the first step on its own. A partner uploads a file, Salesforce creates a Salesforce File, and you capture the ContentDocumentId into a Flow variable. That id is the handle for everything that follows.
Initial screen component:
- File Upload accepts PDF, PNG and JPG.
- Output stores the
ContentDocumentIdin a Flow text collection variable.
Extracting data with Prompt Builder
Prompt Builder with multimodal AI can work on the uploaded document directly. The prompt template inspects PDFs and images for the specific data points you want back. What makes it work is keeping the prompt short and directive, aimed at extraction rather than inference.
Example prompt template:
You are reviewing a partner proof-of-completion document.
Extract the following fields from the uploaded file:
- completionDate
- amount
- quantity
- product
Only return values that are clearly present in the document. Do not infer or guess.
If a required field is missing, include the field name in missingFields.
Return the response in this JSON format:
{
"completionDate": "",
"amount": "",
"quantity": "",
"product": "",
"missingFields": []
}
That "Do not infer or guess" instruction is what keeps the AI returning only what is explicitly on the page, instead of filling the gaps with wrong entries.
Structuring AI output for Flow
The response has to come back in a shape Flow can consume. Predictable JSON fields map straight onto Flow variables:
completionDate→ Date variableamount→ Currency or Number variablequantity→ Number variableproduct→ Text variable, or a lookup helper valuemissingFields→ Text collection or delimited text value
The AI is doing extraction and nothing more. Flow keeps control of the business process logic.
Implementing validation with the Decision element
Once the Prompt Builder action completes, a Decision element checks the missingFields variable.
- If
missingFieldsis not blank, the user goes back to the upload screen with a message naming what is missing, for example "Amount" and "Quantity". They can correct it there and then. - If
missingFieldsis blank, the Flow moves on to the next stage.
Creating the Rebate Claim record
With every required field extracted and validated, the Flow creates the Rebate Claim record, Rebate_Claim__c, populating fields like Completion_Date__c, Claim_Amount__c, Quantity__c and Product__c. The ContentDocumentId captured earlier links the uploaded proof to the claim through ContentDocumentLink, so the file is attached even though the claim record did not exist when the upload happened.
Architectural benefits
Each tool does the part it is good at:
- Flow runs the guided user experience and the process logic.
- The File Upload component handles the initial file intake.
- Salesforce Files stores the document.
- Prompt Builder extracts structured data from that document with multimodal AI.
- Flow validates what came back and controls claim creation.
No custom LWC is needed for standard validation work, which leaves less to maintain and less to rework when the business requirements move.
Practical considerations
- Single vs multiple files. Enforce a single file upload if the business process requires it.
- Prompt strictness. Reinforce the do not infer or guess instruction to keep extraction accurate.
- Data normalization. Add a later step to normalize extracted product names when they differ from what is in Salesforce, for example "Model X-1000" against "X1000 Commercial Unit".
- Raw AI response storage. Storing the raw output is worth it for troubleshooting.
- Human review path. Always keep a route for edge cases to reach a human reviewer.
Leave a Comment