Templates parameter not properly displaying

Certified Senior Developer



I tried upload the template(Doc) many times after editing those not working fields plenty of times  but still the fields seems like above

  Discussion posts and replies are publicly visible

  • 0
    Certified Associate Developer

    Hi Dinesh,

    Curios to look at the html file to understand the fields that are having challenges here. As there are few fields that seems ok, what was the major difference between the fields that are working as expected and the fields that you are facing challenge for?

  • 0
    Certified Lead Developer

    This is a longstanding quirk with the DOCX from Template smart service, caused by unclean editing of the underlying template, in which word-markup XML accidentally gets inserted inside the text of the replacement keys.

    In general the best way to prevent this from happening is to make sure SPELL CHECK and GRAMMAR CHECK are COMPLETELY TURNED OFF in Word.  To fix a given entry, the simplest thing to try is deleting the replacement field, then manually re-typing it from scratch, making sure you type the whole thing in one go.

    The alternative method of fixing these, which works 100% of the time but is quite a bit harder to actually understand if you're unfamiliar with XML, is to edit the underlying XML file in the Docx ZIP file and make sure the "###replacementFieldName###" text blocks are all unbroken.  For this you can merely move text around - you don't need to edit any of the XML but you'd need to make sure whatever XML is there gets left in-place other than moving the plaintext around so it's all together.

    Important side-note: the smart service does not sanitize incoming text in any way when inserting text to fill the replacement fields.  That means characters that mean something else in XML (&, <, >, maybe a few others) need to be either removed or swapped with their XML/HTML equivalents ("&amp;", "&gt;", "&lt;", if i remember correctly).  It also means that if you really know what you're doing, you can inject your own XML to perform certain formatting operations - I actually figured out how to use this to construct entire tables, though that gets very complicated pretty quickly.

  • 0
    Certified Senior Developer

    It looks like you're facing an issue where some fields in the "Configure HTML Doc from Template" setup are not displaying correctly or not mapping as expected, even after re-uploading the document template with changes.

    Here are some steps to troubleshoot this:

    1. Verify Placeholder Syntax: Ensure the placeholders in your document template match exactly what you’ve entered in the "Find in template document" column. Appian is case-sensitive and expects exact matches.

    2. Use Simple Placeholders: If the placeholders contain complex HTML or special characters, try simplifying them to plain text placeholders (e.g., ${fieldName}) to see if they map correctly. After confirming they work, you can revert to more complex placeholders if needed.

    3. Re-Scan Template: After each update to the document template, click "Re-Scan Template" to allow Appian to detect new or updated placeholders.

    4. Clear and Re-Map Fields: Delete the mappings for the problematic fields and re-enter them. Sometimes, Appian retains old references that can cause mapping issues.

    5. Use New Template: As a last resort, try saving your document under a new name and uploading it as a fresh template in Appian. Sometimes, reusing the same file name can cause Appian to cache old template configurations.