Usage of Runtime template in document generation

Certified Senior Developer

Hi All,

I'm facing an issue while generating a document using runtime templates. There is no specific error as such. I'll brief my issue for better understanding.

I'm using an Appian smart service "MS Word 2007 Doc from Template" for document generation. I have created 2 different templates "SWO Templates Type1" and "SWO Templates Type2" (attached for reference)  which needs to be selected at runtime. As a result I have used runtime template to select required templates at run time. The expression used for selecting run time template is given below.

=todocument(if(pv!SPM_CDT.swoType="Add DB2 Storage Groups",'cons!SPM_Document_Type1','cons!SPM_Document_Type2'))

cons!SPM_Document_Type1 --> contains document ID of SWO Templates Type1

cons!SPM_Document_Type2 --> contains document ID of SWO Templates Type2

Base template "SWO Templates" has also been created. (attached for reference).

Problem here is, based on the runtime template expression it is being evaluated to the right document, but no values are being passed to any template.

However, I tried testing all 3 templates by running it separately, it all ran fine. There seems to be a problem when I'm using runtime template.

Not very sure, is there any issue with base template or runtime templates or runtime templates expression.

Can you please help us in identifying the issue here?

Please let me know if any more information is required.

SWO Templates.docxSWO Templates Type1.docxSWO Templates Type2.docx

Thanks

Beena V 

 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    I've checked the background XML in all 3 of your documents.  From what I can tell, you *should* be able to correctly generate documents using SWO Templates Type1, but in the Type2 document, you will run into issues with certain replacement keys due to an old unfixed bug in the Docx from Template smart service (as described here).  And even in that case I would expect some of the replacement fields to work -- if none of them work, then you probably need to keep troubleshooting the syntax of your runtime template document picker box.

    Can you double-check whether you're able to get *any* replacement fields working, for example, with the Type1 template?  (For troubleshooting, you might want to start out with JUST template Type1 being passed in to the runtime field, instead of your current logic, in case there is some syntax mistake there).

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt
    Hi Mike,

    Thanks for the reply. In both Type 1 and Type 2 documents, only ###name### is getting evaluated properly. None of the other keys in the document are getting values. In order to check any syntax error, I even tried using 1 template at a time instead of evaluating at runtime. All 3 documents generated successfully with values for all substitution keys.

    When I use runtime template document picker box, it evaluates to right template but values are not being passed except ###name###.

    Any advise on this?

    Thanks
    Beena V
  • 0
    Certified Lead Developer
    in reply to Beena Venugopal
    I'm surprised ###name### is getting replaced properly but no others.
    One thing I'd like you to try real quick, please: open the smart service node, to the "Setup" tab, and click "Re-Scan Template"... and make sure all the values are still populated after that. Sometimes when there's an issue with the XML code underlying the replacement keys in the template file, and a new version has been uploaded with some incompatibility introduced, the inputs will get cleared out when you try this.
Reply
  • 0
    Certified Lead Developer
    in reply to Beena Venugopal
    I'm surprised ###name### is getting replaced properly but no others.
    One thing I'd like you to try real quick, please: open the smart service node, to the "Setup" tab, and click "Re-Scan Template"... and make sure all the values are still populated after that. Sometimes when there's an issue with the XML code underlying the replacement keys in the template file, and a new version has been uploaded with some incompatibility introduced, the inputs will get cleared out when you try this.
Children
No Data