Question
Wipro Technologies Limited
IN
Last activity: 16 Oct 2018 12:03 EDT
Generate MS Word Doc and Attach To Case
I am successfully able to generate and download the word document by generating it with the function com.pegarules.generated.pega_appdefinition_documentapp.pzGenerateDocument
Additionally I have a requirement to attach the word document to a Pega case. The url string returned by the function com.pegarules.generated.pega_appdefinition_documentapp.pzGenerateDocument contains * for which Pega Engine APIs to instantiate a PRFIle type object is throwing runtime exceptions.
Also tried with the standard java function new java.net.URL() but unable to create (object null) any URL object from the url string.
If someone has implemented this sort of a requirement kindly suggest
**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.
Hi,
I am successfully generated the document with dynamically passed data from work object also document attached to work object. Here are the steps below.
1. Call the pega_appdefinition_documentapp.pzGenerateDocument pass the template name and class name
2. Above function returns the url of the file generated in server temp folder path, write java logic to read file stream using file url
Get the filename from the returned i.e pega_rules_string.whatComesAfterLast(url, '/');
open file using pega.getStaticContentUtils().getServiceExportRoot(); + filename and read the stream.
3. Use the filestream as your pyAttachStream for your attachment page and set other properties for attachment page. Similar to adding a new attachment.
Hi,
I am successfully generated the document with dynamically passed data from work object also document attached to work object. Here are the steps below.
1. Call the pega_appdefinition_documentapp.pzGenerateDocument pass the template name and class name
2. Above function returns the url of the file generated in server temp folder path, write java logic to read file stream using file url
Get the filename from the returned i.e pega_rules_string.whatComesAfterLast(url, '/');
open file using pega.getStaticContentUtils().getServiceExportRoot(); + filename and read the stream.
3. Use the filestream as your pyAttachStream for your attachment page and set other properties for attachment page. Similar to adding a new attachment.
Hope this helps, let me know any questions.
Thank you!
Sri