In addition to configuring mappings for the individual fields of the record running the Smart Form, you can also loop through information on items in the Related List of the running record. As an example, Work Order Line Item is on the related list of a Work Order, and you can have more than one Work Order Line Item per Work Order. Loops allow you to iterate through a Work Order's Work Order Line Item records, accessing the fields you choose for each loop. 


Please make sure you have already created a Mapping Set by covering this article: How to use Smart Form Mapping - Create Mapping Set


You can create your own Related List Object, but in this case Work Order Line Item will be the example as it is a standard object. 


Create a Loop Element 


1. Create a Loop Element that encapsulates elements that will hold the fields you want to access for each Work Order Line Item. 



For more information on configuring Loop Elements in the Designer, please see this article for details: Configuring Loops


2. Navigate to the Mapping tab of the Loop's Element Edit Properties Window and define Data Mapping.



FieldFunction 
Field Mapping References the Related Object's API Name (please see here for more information: Mapping an Element with the Mapping Lookup tool)
Data ActionFor more information, please see: Smart Form Data Actions for Element Mapping
Relationship Field nameAPI Name of the field that relates Work Order Line Item to Work Order as shown below (Master-Detail field name)

    

Optionally, you can also configure SOQL statements to filter the results of the Loop and set the order by which the Related List records should be iterated. For more information on Salesforce's Object Query Language, please see this article: Salesforce Object Query Language (SOQL)



Here, only Work Order Line Items with the Status 'New' will be looped through, and the Work Order Line Items will loop through in numerical order ascending.


3. Next, define Data Mapping for the Elements within the Loop that will access fields from the Related Object item. 



Here, this Element has been mapped to access the Number field of the Work Order Line Item Object. 'WorkOrderLineItem' comes first in the syntax as this is the Related Object API Name and 'LineItemNumber' is the field API Name you want to display for every Work Order Line Item looped through.


3. Save your changes.