Question

Create case by parsing XML and attaching pdf to the created case

Hi ,

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?

Regards,

Bidyun

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Correct Answer
December 19, 2016 - 11:42am

Hi Team,

We have achieved this functionality by creating a custom java code which ingests the parameters for the Source File Location and the PDF file name and attaches it to the case created using the XML.

The java code is being invoked after the case creation activity has executed.

Regards,

Bidyun

Comments

Keep up to date on this post and subscribe to comments

November 22, 2016 - 4:25pm

Hello Bidyun,

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.

Thanks,

Mike

November 30, 2016 - 2:56pm
Response to MikeTownsend_GCS

Hi Mike,

>>where the utility takes the file name and looks for name.pdf >> How can we check for this as the file is still not in Pega but in the network folder on which the listener is polling?

Regards,

Bidyun

Pega
November 23, 2016 - 7:37am

I agree to what Mike has suggested. You have to use an utility and come up with your logic which will attach the pdf to your assignment. You can check this article to get some idea on this. 

November 23, 2016 - 7:56am

>>> 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.

/Eric

 

 

November 23, 2016 - 4:16pm

Hi Team,

Thank you for your responses. I shall try them out and get back with the results!

Thanks,

Bidyun

December 19, 2016 - 11:42am

Hi Team,

We have achieved this functionality by creating a custom java code which ingests the parameters for the Source File Location and the PDF file name and attaches it to the case created using the XML.

The java code is being invoked after the case creation activity has executed.

Regards,

Bidyun