(Example) Show a Subform in an E-mail Notification
This example shows how to display the data from a subform in an e-mail notification.
Background and Setup
Result
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:
When you complete this example procedure, the finished e-mail notification that shows the data from a subfrom looks like this:
Prerequisites
- This example usesSales Invoice app from the AgilePoint NX App Store.
For more information, refer to How to Get the App.
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 e-mail template to use a subform in an e-mail notification.
How to Start
- Click Build Apps .
- On the Application Explorer screen, on the My Application pane, click Sales Invoice > Processes > Sales Invoice > Process Model > Sales Invoice.
Procedure
- On the Sales Invoice process, in the Finance Manager Approval activity, click Activity Settings > Configure Activity .
- In the eForm Configuration screen, click E-mail Notifications .
- On the E-mail Notifications screen, in the Initiation tab, click Edit
- In the E-mail Template Configuration screen, click the Content tab.
- On the Content tab, in the e-mail body, enter Invoice Items:.
- On the Process Data screen, click E-mail Macro.
- In the e-mail body, under Invoice Items:, drag $XMLREPEATING2HTML().
- 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.
- In the e-mail body, drag SALESINVOICEITEMS_US within parenthesis () of $XMLREPEATING2HTML().
The SALESINVOICEITEMS_US is an internal name of the subform.
- 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.
- Click OK.
The E-mail Notifications screen shows.
- On the E-mail Notifications screen, click Finish.
The Sales Invoice process screen shows.
- Click Save and Check In .
Step 2: (Optional) Publish and Run the Application
Next, publish the application so people can use it.
Procedure
- To publish the app, refer to Publish a process-based application.
- To run the app, refer to Start your process.
Step 3: (Optional) View the Data from a Subform in E-mail Notification
Next, view the data from a subform in e-mail notification.
Prerequisites
Procedure
- On the Sales Invoice Request form, complete the required (*) fields.
- Click Submit.
The finance manager receives an e-mail with the subform data.
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.
Prerequisites
- AgilePoint NX OnDemand (public cloud), or AgilePoint NX PrivateCloud or AgilePoint NX OnPremises v7.0 or higher.
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.
Procedure
- Click App Store .
- In the CATEGORY section, click Sales.
- Click the Sales Invoice app.
- On the Sales Invoice screen, click Add.
- On the Trust App screen, click Trust it.
- Click Return to site.