Step 3 - Create Apex Class (Document AI API Wrapper)
Create a custom Apex class to enable the Document AI flow functionality. This Apex class:
- Allows the Salesforce flow to invoke the Data 360 Document AI functionality
- Passes in necessary credentials and document identities
- Receives a clean JSON output of the extracted bank statement data
- Go to the Setup Menu.
- From the dropdown menu, select Developer Console.
- In the Developer Console, click File > New > Apex Class.
- Enter the class name:
de_BankStatementExtractorand click OK. - When the code editor opens, paste this code into the editor and save the file.
This is an out-of-the-box class that includes a method invoked by the flow you create on the next step. If you choose to use a different Apex class, make sure it includes such an invocable method. This class also contains a hardcoded override for the LLM model. If you use a different model, update the llmModel string.
- Step 4 - Create Bank Statement Extraction Flow (Apex Wrapper): Create a screen flow to extract data from the customer's bank statement.