Create case by parsing XML and attaching pdf to the created case
We have a requirement as below:
We have two files one XML (e.g ABC.xml) and the other pdf(e.g ABC.pdf). The XML is prepared by some external XML generator by parsing the contents of the PDF and the generator is providing both these files into our Pega application folder. Note that the names of the files are same apart from the file type extension.
Now , the requirement is we need to parse the XML, create the case using the MetaData in the XML and finally attach the related PDF to the case. Using a file listener we have acheived this functionality of parsing the XML and creating the case. But the listener doesn't have the capability to wait and check for the related PDF by polling the network folder again. It can process only one file at a time (in this case its the XML) and the transaction is complete. It doesn't check/wait for the incoming pdf.
Is there a way we can invoke some functionality (java code ,Connect methods etc) to check if the pdf with same name exists in the network folder and if it exists we attach it to the case?
Could you create a utility shape in your flow that runs after entry and before the first assignment shape, where the utility takes the file name and looks for name.pdf, if it is present upload and attach the file? That way you're leveraging an actively running flow to update the case with the information.
>>> Is there a way we can invoke some functionality (java code ,Connect methods etc) to check if the pdf with same name exists in the network folder and if it exists we attach it to the case?
For the check-if-exists part of this question: See if the methods shown in "developer portal > (i) > Engine API > class PRFile" are of use for this.
For the attach-it-to-the-case part, please trace a usage of the create-and-attach-pdf flow shape. The part of the trace that is important for answering your question is the part that attaches the file after the pdf is created.