Parsing the attached document using GEN AI and showing parsed structured response in same screen

Current setup:

  • On the review screen, the customer uploads a new address proof using the OOTB attachment field.

  • I created a property called AttachAddressData of type Attachment.

  • I referenced this property in the view, so Pega renders the attachment control.

  • After the user submits the screen, I am able to call a GenAI Connect rule on the server side, parse the uploaded document, and prefill the new address fields successfully.

Problem:

  • This works only after submit and only on the next screen.

  • I want the parsing to happen immediately when the document is uploaded, so the address fields are prefixed/prefilled on the same screen without waiting for submit.

What I need:

  • Is there a supported OOTB way in Constellation to trigger GenAI parsing as soon as the attachment is uploaded and refresh the same form?

  • If not, is the recommended approach to build a custom DX component that combines:

    1. document upload,

    2. server-side GenAI parsing call,

    3. and immediate field prefilling in the same view?

What I am trying to achieve:

  • Upload attachment.

  • Call server-side GenAI parsing immediately.

  • Populate address fields in the same screen.

  • Avoid requiring submit just to run the parsing.

Any guidance, sample pattern, or best practice would be appreciated.

Hi Ram

Have you tried using flow action form refresh and having a Datapage with gen ai connect as source.it should work.

yes i have explored that option. flow action form refresh cannot accept attachment property as a refresh trigger.

Ok how about having another field (calculated field) which can be fired whenever this property value changes.

Declare expression of this new calculated field can refer this Datapage. Worth a try.

I recommend the following options,

  1. Use “Extract data from the Image” checkbox to trigger the form refresh settings.
  2. Use Screen flow to attach the document on 1st step and extract the content on 2nd step.

Can you tell me how to do this document parse via method 1.. i.e using form refresh. when i attach a document and having another checkbox with refresh setting (The attached document still not available at server side isnt it for me to run a activity /flow against the case to parse this document). am i right ? i tried using activity/flow but parsing is not working

My solution is based on the screenflow, you attach the document on Screen 1 and show the extracted contents on screen 2. Trigger the Gen AI connect automation step or invoke teh Gen AI activity on the Post flow action on Screen1.