Question
EIB
PL
Last activity: 7 Sep 2021 1:00 EDT
Embedding correspondence in a word template
Hi,
I use the below field code in a word template. But correspondence content is not embedded in the generated file. Field code remains as is. Is there anything missing ?
{pega:insert corr=xyz}
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
AU
@EngincanY Can you please explain your usecase? What outcome are you after? Do you want to copy the output of pega property into MS word document?
Rulesware
PE
@EngincanYThe code you are referring to is outdated, it uses the old Word Merge engine. In Pega 8.6 it still works but it is not recommended because it uses MS Silverlight which is now deprecated. By the way, to insert the code you mention, you have to insert with the Quick Parts button of MS Word, then add the formula "pega:inser corr=CorrespondenceName".
But I think it's better to use the Generate Document smart shape for this purpose. This is a video where I show how to use it inserting a correspondence into a MS Word document: https://www.youtube.com/watch?v=wZP1WgH2SBQ
If you are still interested in the old way (using Word Merge), I have created a video on this (although in Spanish), please jump to min 11:00: https://www.youtube.com/watch?v=r58gQmD8K0A
-
Gurpreet Dhanoa Engincan Yildiz deivit mamani Sarumathi P
EIB
PL
@Deivit Thank you for your answer. I tried using smart shape and included below string in word document.
<pegaref config={"name":"my correspondence rule name","type":"C"}>
But following error appears in the generated document.
ERR_SKIP_HTML_IN_TABLE
Error description says "A table cannot contain content from a section, correspondence, a rich text editor, or HTML."
https://community.pega.com/knowledgebase/articles/case-management/84/case-documents-error-messages
I am not using any table in the correspondence, just p and span tags. Any idea about this error ?
Updated: 6 Sep 2021 9:02 EDT
Rulesware
PE
@EngincanY Could you try adding your HTML progressively. I mean, first add a simple hello world, then a simple paragraph, until the error appears.
Also, you can try adding the html directly to the correspondence or in an html section or even in an html rule.
Or you can post here your HTML or a minimal version of it in order to replicate
EIB
PL
@DeivitThe issue resolved when I placed pega reference outside of table in word document. I assume that pega refers to a table in document. So, embedding correspondence/section inside a table in word document isn't supported I guess.
-
Lakshman Kumar Thota
Rulesware
PE
@EngincanYI hope you resolved your issue. But if you really need to put it in a table, you can try with the old Word Merge engine (although not recommended) using the following java step / function
String url = com.pegarules.generated.pega_appdefinition_documentapp.pzGenerateDocument( templateName, tools, templateClass, null );
you can download the generated document using the URL string.
EIB
PL
@DeivitCorrespondence content is not embedded using that function. I was actually using that function and that's why I posted this question. Anyway, I will continue to embed a property although it doesn't fulfill the business requirement completely. I guess there is no other option.
Updated: 6 Sep 2021 10:15 EDT
Rulesware
PE
@EngincanYI tried and it worked to me. Did you created the correspondence as an email or a mail? In my tests, it worked only when the correspondence is a "mail", not "email".
Edit: I attached screenshots of my word template as well as the correspondence rule and the result. Note: when inserting the formula, it will appear blank empty in the document but it is actually there, just right click > toggle Field Code and it will appear.