Step 4 - Create Bank Statement Extraction Flow (Apex Wrapper)

Create a screen flow to invoke your Apex method that extracts data from the customer’s bank statement.

On the App Launcher, create a new flow to extract data from the customer’s bank statement.

  1. From the App Launcher, select Flows.
  2. Click New to create a new flow.
  3. Select the Autolaunched Flow (No Trigger) automation.
  1. In the Flow Builder, under Autolaunched Flow, click the + button.
  2. Select Action, and search for your Apex method under Search Actions on the right (Run Bank statement analysis using DataCloud Document AI).
  3. Enter a flow label: Bank_Statement_Extraction.
  1. Open the toolbox on the top left and click New Resource to create input variables.

  2. The New Resource modal opens. Select Variable as Resource Type.

  3. Enter ContactEmail as API Name.

  4. Select Text as Data Type.

  5. Check the checkbox next to Available for input.

  6. Click Done.

  7. Repeat steps 2-7 for these items:

    • Org_Domain
    • Client_Id
    • Client_Secret
    • Document_Type
    • LLM_Model
    • ContentDocumentId
    • IDPConfigId
  1. Open the toolbox on the top left and click New Resource to create output variables.

  2. In the New Resource modal, Select Variable as Resource Type.

  3. Enter Status as API Name.

  4. Select Text as Data Type.

  5. Select Available for output.

  6. Click Done.

  7. Repeat steps 2-7 for these items:

    • ExtractedDataJson
    • ErrorMessage
  1. Under Set Input Values on the right, enter these values to map the inputs.

    • Org_Domain → {!Org_Domain}
    • Client_Id → {!Client_Id}
    • Client_Secret → {!Client_Secret}
    • Document_Type → {!Document_Type}
    • LLM_Model → {!LLM_Model}
    • ContentDocumentId → {!ContentDocumentId}
    • IDPConfigId → {!IDPConfigId}

Input Mapping

  1. Under View Output Resources, select Manually assign variables (advanced).

  2. Under Store Output Values, enter these values.

    • Status → {!Status}
    • ExtractedDataJson → {!ExtractedDataJson}
    • ErrorMessage → {!ErrorMessage}

Output Storing

  1. Click the Save button, and save the flow as: Bank_Statement_Extraction.
  2. On the saving modal, go to Show Advanced. Under How to Run the Flow, select System Context Without Sharing–Access All Data.
  3. Click Save.
  4. On the top right, click Activate to activate the flow.