web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Extract Information Fr...
Power Automate
Unanswered

Extract Information From Documents Action Not Extracting Custom Text Field from AI Model in Flow

(1) ShareShare
ReportReport
Posted on by
I used the "Recognize text in an image or a PDF document" action to read text from invoice PDFs I upload to SharePoint. I then initialized and set a Purchase Item variable (as a string) that includes all of the Purchase Items to search each invoice PDF for. If any of these words are included in the documents, I then added a "Create File" SharePoint action that adds those words to the file name. (The search uses the OR function, meaning I don't it to look for the presence of ALL words, but rather any of these words).
 
Earlier in the flow, before the "Recognize text in an image or a PDF document" action, I created another variable, New File Name. that includes outputs from three other parts of the PDFs and creates a file naming convention using those outputs. I'd initially tried to include the Purchase Item in this first variable, but the flow wasn't recognizing it for some reason. I believe it's because the Purchase Item doesn't have a clear label on each invoice. My workaround for this was to use the "Recognize text in an image or a PDF document" action to search for these words instead, and then add them to the New File Name variable.
 
However, this unfortunately also didn't work. The Purchase Item variable I created remains empty, even though I can see the "Recognize text in an image or a PDF document" action has accurately extracted text from the PDFs in its outputs. My flow does accurately rename each invoice the New File Name variable, though. It just doesn't include the Purchase Item at the end of it. I'm not sure how to resolve this and would greatly appreciate any guidance!! Below are the inputs of the actions and variables mentioned above. Let me know if I can provide any other information that'd be helpful in troubleshooting.
  • Recognize text in an image or a PDF document:
    • body('Get_file_content_using_path')
  • Initialize variable New File Name:
    • replace(replace(replace(
          concat(
              outputs('Extract_information_from_documents')?['body/responsev2/predictionOutput/labels/FieldA/text'],
              '_',
              outputs('Extract_information_from_documents')?['body/responsev2/predictionOutput/labels/FieldB/text'],
              '_',
              outputs('Extract_information_from_documents')?['body/responsev2/predictionOutput/labels/FieldC/text']
          ), '.', '-'), '/', '-'), '\', '-')
  • Initialize variable Purchase Item:
    • trim(concat(
          if(contains(coalesce(outputs('Recognize_text_in_an_image_or_a_PDF_document')?['body/responsev2/predictionOutput/fullText'], ''), 'ACD215'), 'ACD215-', ''),
          if(contains(coalesce(outputs('Recognize_text_in_an_image_or_a_PDF_document')?['body/responsev2/predictionOutput/fullText'], ''), '4wX2rRH553'), '4wX2rRH553-', ''),
          if(contains(coalesce(outputs('Recognize_text_in_an_image_or_a_PDF_document')?['body/responsev2/predictionOutput/fullText'], ''), '875snToWPF31Ne'), '875snToWPF31Ne-', ''),
       
      ))
  • Create File:
    • concat(
          variables('NewFileName'),
          trim(concat(
              if(
                  contains(toLower(trim(coalesce(outputs('Recognize_text_in_an_image_or_a_PDF_document')?['Text'], ''))), 'ACD215'),
                  'ACD215-',
                  ''
              ),
              if(
                  contains(toLower(trim(coalesce(outputs('Recognize_text_in_an_image_or_a_PDF_document')?['Text'], ''))), '4wX2rRH553'),
                  '4wX2rRH553-',
                  ''
              ),
              if(
                  contains(toLower(trim(coalesce(outputs('Recognize_text_in_an_image_or_a_PDF_document')?['Text'], ''))), '875snToWPF31Ne'),
                  '875snToWPF31Ne-',
                  ''
              )
          ))
      )
Categories:
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 796

#2
Valantis Profile Picture

Valantis 671

#3
Haque Profile Picture

Haque 551

Last 30 days Overall leaderboard