Articles in this section

How to group elements and adjust their visibility in a document

This article explains how to group elements in a document based on specific conditions so they can be visible, hidden, or deleted when generating the template.

  Prerequisites

  • Library and at least one Dynamics modules enabled.
  • Templafy Desktop and Office VSTO add-in installed on the PC.
  • Space owner access to the Templafy tenant.

  Important

The Group smart field is only available in Word.

Often, when building smart documents some elements should be visible, hidden, or deleted based on specific conditions using IfElse statements, the Group smart field can be used for that purpose. Follow these steps to create Group smart field: 

  1. In Template Designer, navigate to the Template tab.
  2. Select the elements that should be grouped together.
  3. Click + Add smart field.
    This step doesn't apply if you are adding the very first smart field in the template.
  4. Expand the section by clicking on More.
  5. Click on Group.
    Group_SelectSmartFieldGroup.png
  6. Optionally edit the Display name.
    The display name will be displayed in the Template tab once the smart field has been added.
  7. Select the desired Visibility
    Group_SelectVisibility.png
    • Always show: the group will always be displayed without any conditions.
    • Expression builder: the group will be displayed based on a (simple) condition using the Expression builder. 
    • Custom visibility: the group will be displayed based on a visibility expression (binding) that is typed. 
  8. Specify the Visibility for the group.
    Expression builder Custom visibility

    The template contains a text form response field 'Your_reference'. The sentence regarding 'your reference' is selected and a Group smart field using the Expression builder is created. The Visibility condition is: 
    IF 'Form.Your_reference' 'Is empty' THEN 'Hide' ELSE 'Show'

    Group_ExpressionBuilder.png

    • If the question is filled by the user, the reference group is visible in the document.
    • If the question isn't filled by the user, the reference group is hidden in the document.
     
  9. Optionally, perform an additional action on the smart field:
    Allow updates: Allow the smart field to be updated after its generation when edited by the user through the Document content updaterThis option will not be visible if the document content updater is not enabled on the smart template. 

      Important

    Using VisibilityType.Delete will prevent the Allow updates option to work as it will delete the content control on document generation which will effectively disable the Document content updater for this group.

     

  10. Click Add to template.
    The smart field will be injected into the template and will be displayed in the Template tab.
    Expression builder Custom visibility
    Group_ExpressionBuilderAdded.png

  Note

conditions contains custom text binding custom chart binding tech_role
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.