(Example) Show a Subform in an Email Notification

This example shows how to display the data from a subform in an email notification.

Background and Setup


This example shows how to add a SALESINVOICEITEMS subform to Assignment Notification e-mail template in the Sales Invoivce app.

When you add the Sales Invoice app from the App Store to your App Builder, and submit the Sales Invoice Request form, the finance manager receives an e-mail notification for approval that is configured in Finance Manager Approval activity. The e-mail notification looks like this:

Email Notification Preview

When you complete this example procedure, the finished e-mail notification that shows the data from a subfrom looks like this:

Email Notification Final


Good to Know

  • The $XMLREPEATING2HTML() e-mail macro shows all fields of the subform, such as hidden fields, internal fields, and the Data Entities default fields, even if these do not show on your eForm. If you want to remove the fields from the e-mail notification that shows the data from a subfrom, use the $XMLREPEATING2HTMLWITHFILTER() e-mail macro.
  • The column headings that display in the e-mail notification are the internal names of the fields. It is not possible to show the display names.
  • Sales Invoice is an app that creates an invoice for the products sold.

    For the use case in this example, a subform called SALESINVOICEITEMS shows in an Assignment Notification e-mail template so the manager can see the invoice items to approve the sales invoice request based on the information in the e-mail.

Step 1: Configure an E-mail Template to Add a Subform

First, configure an email template to use a subform in an email notification.

How to Start

  1. Click App Builder.

    Build Apps screen
  2. On the App Explorer screen, click Sales Invoice > Processes > Sales Invoice > Process Model > Sales Invoice.

    Sales Invoice app


  1. On the Sales Invoice process, in the Finance Manager Approval activity, click Activity Settings Activity Settings icon > Configure Activity Configure Activity icon.

    Sales Invoice Process screen
  2. In the eForm Configuration screen, click Email Notifications E-mail Notifications icon.

    eForm Configuration screen
  3. On the E-mail Notifications screen, in the Initiation tab, click Edit Edit icon

    E-mail Notifications screen
  4. In the E-mail Template Configuration screen, click the Content tab.

    E-mail Template Configuration screen
  5. On the Content tab, in the e-mail body, enter Invoice Items:.

    Content tab
  6. On the Process Data screen, click E-mail Macro.

    Process Data screen
  7. In the e-mail body, under Invoice Items:, drag $XMLREPEATING2HTML().

    E-mail Macro screen
  8. Click the DataSource External tab.

    The Sales Invoice app used Data Entities data source and the form controls are mapped to fields in the associated entity so the form fields show in DataSource External tab.

    Process Data screen
  9. In the e-mail body, drag SALESINVOICEITEMS_US within parenthesis () of $XMLREPEATING2HTML().

    The SALESINVOICEITEMS_US is an internal name of the subform.

    Data Source External screen
  10. Add a tilde (~) at the end of Xpath.

    $XMLREPEATING2HTML(${/pd:AP/pd:dataSource/pd:APDataEntity/ pd:SalesInvoice/pd:SalesInvoice__u/pd:SALESINVOICEITEMS__US~})

    The tilde returns the inner XML for the element to which the Xpath refers.

    E-mail Template Configuration screen
  11. Click OK.

    The E-mail Notifications screen shows.

    E-mail Notifications screen
  12. On the E-mail Notifications screen, click Finish.

    The Sales Invoice process screen shows.

    Sales Invoice screen

Step 4: (Optional) View the Data from a Subform in E-mail Notification

Next, view the data from a subform in email notification.



  1. On the Sales Invoice Request form, complete the required (*) fields.

    Sales Invoice Request form
  2. Click Submit.
    The finance manager receives an e-mail with the subform data.

    Email Notification Final

How to Get the App

This example is based on the Sales Invoice app from the AgilePoint NX App Store. Use this procedure to get the app.


Good to Know

  • This procedure is optional. It is provided so you can test the example with an out-of-the-box app.
  • This is part of the Background and Setup procedures, but many users preferred this step to appear after the example, not before it.


  1. Click App Store App Store icon.

    App Store
  2. In the CATEGORY section, click Sales.

    App Store screen
  3. Click the Sales Invoice app.

    Sales Invoice screen
  4. On the Sales Invoice screen, click Add.

    Sales Invoice screen
  5. On the Trust App screen, click Trust it.
  6. Click Return to site.