I am trying to find a word in a PDF (the word is Previous) and if that word exists, continue the process. If that word does not exist, end the process. I have an activity to open up the PDF and my though is, use an assign to find the word, then use an IF and create a condition stating If the variable is true (meaning the word exists) then use continue activity, else send out an email alert and terminate workflow.
I’m not sure how to do this the right way or if this is the right way to handle.
In my opinion, the best way to fulfill your needs, would be either using UiPath PDF activities, (if the PDF is native), or OCR (if the PDF is a scanned file)
Native: (Means that the text is selectable in PDF)
Package required for both cases:
Activities to use:
Yellow = Native
Green = Scanned
Both of them will give a string as an output.
With that string you can build the condition directly in the “IF” activity:
IF Condition: var_StringPDFOutput.Contains(“Previous”) → This will give either True or False depending on if the word exists in the PDF or not.
Since you seem far more advanced than myself, in the else i put a send email (which worked) and after that i want to end my entire process.
When i add “Terminate workflow” it terminates but it gives me a pop up of an error. How do i stop that or is there a better way to cancel the workflow?
Put this in a flowchart instead of a sequence. In the else assign an integer to something like success|1 or something like that and take the send email message out of the else. Then use a flow decision with a condition if success = 1 then send an email. The process will stop after that.
If you are using a state machine then you can add a throw with a new business rule exception with your message and have a business rule exception isNot Nothing path to the end state and your automation will stop
If the bot reaches this path, it will skip the rest of the “Sequence” or “Flowchart” and it will jump to the “Catch” of type “BusinessRuleException”. Therefore reaching the end and finishing:
Please note that if you run on Debug, to reach the “catch” you’ll need to click several times the Continue button. Running normally will not trigger the stops on the code