Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

pzGenerateDocument removes a paragraph

SA-97110

Summary

User performs word merge with pzGenerateDocument. However, a paragraph is removed from the template and the generated document contains the below content:

The policy number {pega:reference name=pyWorkPage.policyNo} is correct


Error Messages



(pega_appdefinition_documentapp) ERROR - Exception in parsing the word templatecom.pega.pegarules.pub.PRRuntimeException: Failed to find instance Rule-Template-Word. pega:reference pyWorkPage.currentdate.Mail of type Rule-Obj-Corr. 


Steps to Reproduce

Apply pzGenerateDocument on a sample Word template with the below content:
The policy number {pega:reference name=pyWorkPage.policyNo} is correct


Root Cause



A defect in Pegasystems’ code or rules: parseandpopulate() in the pzGenerateDocument function rule.

public void parseAndPopulate() {
            final String XPATH_TO_SELECT_TEXT_NODES = "//w:p";
            //java.util.List<Object> jaxbNodes = mlPackageReadOnly.getMainDocumentPart().getJAXBNodesViaXPath(XPATH_TO_SELECT_TEXT_NODES, false);
            //updated to read entire content of the template instead of just paragraph tags, this change is made to support tables in the source document template
            java.util.List<Object> jaxbNodes = mlPackageReadOnly.getMainDocumentPart().getContent();
            for (Object jaxbNode : jaxbNodes) {
                if(jaxbNode.getClass().getName().equals("org.docx4j.wml.P")){
                  try{
                    final String paragraphString = jaxbNode.toString();
                    if (containsPegaTag(paragraphString)) {
                        if (paragraphString.contains("corr")) {
                            String pegaTag = extractPegaTags(paragraphString);
                            if(pegaTag.equals(BLANK) || pegaTag.equalsIgnoreCase("attachment") || pegaTag.equalsIgnoreCase("binaryfile") || pegaTag.equalsIgnoreCase("binary")) continue;
                            fetchHtmlStreamFromPegaTag(pegaTag,"corr");

The sample paragraph has the word, 'correct', in it. The {pega:reference} tag with policyNo fails since it searches for the policyNo Correspondence rule as per code.


Resolution



An enhancement request, FDBK-64888, is created for consideration by Pega Product Management. 

 

 

Suggest Edit

Published June 6, 2020 - Updated December 2, 2021

Did you find this content helpful? Yes No

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us