#foreach
The #foreach data helper can be used to automatically output a list of:
- Matter tasks
- Matter task notes
- Shared documents
- Matter accounting entries
- Matter time recording entries
A #foreach statement is made up of the below:
- Collection: the data you wish to output, see below for a list of options.
- [Optional] Sort By: the data type the list should be ordered by, the options are:
**Sort-By**: for text fields**Numerical-Sort-By**: for numerical or currency fields**Date-Sort-By**: for date or date and time fields- [Optional] Name: the data field the list should be ordered by, see below for a list of options.
- [Optional] Direction: the way in which the data should be ordered, the options are:
- Ascending 1. For text fields, this would order them from A to Z 2. For numerical fields, this would order them from smallest to largest 3. For date fields, this would order them from oldest to most recent
- Descending 1. For text fields, this would order them from Z to A 2. For numerical fields, this would order them from largest to smallest 3. For date fields, this would order them from most recent to oldest
For example, the below statement would output a list matter tasks, sorted alphabetically (a-z) by the task’s name.
{{#foreach matter.tasks sort-by taskname asc}}
Matter Tasks
Section titled “Matter Tasks”All Tasks
Section titled “All Tasks”The following statements can be used to output a list of tasks on the matter that are visible to a stakeholder:
| Statement | Output |
|---|---|
| {{#foreach matter.tasks}} | |
| {{taskname}} | The name of the task |
| {{description}} | The Stakeholder description of the task |
| {{#foreach notes}}{{createdby}}{{#datetime createdon}}{{content}}{{#endforeach}} | Any Notes on the task, including:The name of the User that generated the noteThe date and time the note was addedThe description of the note |
| {{#endforeach}} |
Completed Tasks
Section titled “Completed Tasks”Use the following statements to output a list of completed tasks on the matter which are visible to that stakeholder:
| Statement | Output |
|---|---|
| {{#foreach matter.completedtasks}} | |
| {{taskname}} | The name of the completed task |
| {{description}} | The Stakeholder description of the completed task |
| {{#datetime completedon}} | The date and time the task was completed on the matter |
| {{#foreach notes}}{{createdby}}{{#datetime createdon}}{{content}}{{#endforeach}} | Any Notes on the completed task, including:The name of the User that generated the noteThe date and time the note was addedThe description of the note |
| {{#endforeach}} |
Newly Completed Tasks
Section titled “Newly Completed Tasks”Use the following statements to output a list of newly completed tasks on the matter which are visible to that stakeholder:
| Statement | Output |
|---|---|
| {{#foreach matter.newcompletedtasks}} | |
| {{taskname}} | The name of the newly completed task |
| {{description}} | The Stakeholder description of the newly completed task |
| {{#datetime completedon}} | The date and time the task was completed on the matter |
| {{#foreach notes}}{{createdby}} on {{#datetime createdon}}{{content}}{{#endforeach}} | Any Notes on the newly completed task, including:The name of the User that generated the noteThe date and time the note was addedThe description of the note |
| {{#endforeach}} |
Outstanding Tasks
Section titled “Outstanding Tasks”Use the following statements to output a list of outstanding tasks on the matter which are visible to that stakeholder:
| Statement | Output |
|---|---|
| {{#foreach matter.incompletetasks}} | |
| {{taskname}} | The name of the outstanding task |
| {{description}} | The Stakeholder description of the outstanding task |
| {{#foreach notes}}{{createdby}} on {{#datetime createdon}}{{content}}{{#endforeach}} | Any Notes on the outstanding task, including:The name of the User that generated the noteThe date and time the note was addedThe description of the note |
| {{#endforeach}} |
Shared Documents
Section titled “Shared Documents”Use the following statements to output information on any documents that have been shared with the Stakeholder within their Portal:
| Statement | Output |
|---|---|
| {{#foreach documents}} | |
| {{name}} | The name of the file shared with the Stakeholder |
| {{#datetime sharedon}} | The date and/or time the file was shared with the Stakeholder.Configure the output using our #datetime data helper. |
| {{#endforeach}} |
Matter Accounts
Section titled “Matter Accounts”Receivables
Section titled “Receivables”Use the following statements to output details of the receivables on a matter:
| Statement | Output |
|---|---|
| {{#foreach matter.receivables}} | |
| {{details}} | The receivables details |
| {{account.name}} | The account the receivables raised against |
| {{amount}} | The amount of the receivable excluding VAT |
| {{tax}} | The amount of any VAT applied to the receivable |
| {{total}} | The total amount of the receivable including VAT |
| {{#endforeach}} |
Invoices
Section titled “Invoices”Use the following statements to output details of any invoices and standalone credit notes on a matter:
| Statement | Output |
|---|---|
| {{#foreach matter.clientinvoices}} | |
| {{#datetime createdon}} | The date the invoice was raised |
| {{#datetime duedate}} | The invoice due date |
| {{reference}} | The invoice reference |
| {{paid}} | The total amount paid |
| {{outstanding}} | The total amount outstanding |
| {{total}} | The total amount of the invoice including VAT but excluding any credit notes applied |
| {{#endforeach}} |
Supplier Bills
Section titled “Supplier Bills”Use the following statements to output details of any supplier bills on a matter:
| Statement | Output |
|---|---|
| {{#foreach matter.supplierbills}} | |
| {{#datetime createdon}} | The date the supplier bill was raised |
| {{#datetime duedate}} | The supplier bill due date |
| {{reference}} | The supplier bill reference |
| {{paid}} | The total amount paid |
| {{outstanding}} | The total amount outstanding |
| {{total}} | The total amount of the supplier bill including VAT but excluding any credit notes applied |
| {{#endforeach}} |
Client Deposits
Section titled “Client Deposits”Use the following statements to output details of any client deposits on a matter:
| Statement | Output |
|---|---|
| {{#foreach matter.client.deposits}} | |
| {{details}} | The details of the deposit |
| {{amount}} | The total amount of the client deposit |
| {{#datetime date}} | The date of the deposit |
| {{#endforeach}} |
Anticipated Deposits
Section titled “Anticipated Deposits”Use the following statements to output details of any anticipated client deposits on a matter:
| Statement | Output |
|---|---|
| {{#foreach matter.client.anticipated.deposits}} | |
| {{details}} | The details of the deposit |
| {{amount}} | The total amount of the client deposit |
| {{#datetime date}} | The date of the deposit |
| {{#endforeach}} |
Matter Ledger
Section titled “Matter Ledger”Use the following statements to output details of the matters ledger:
| Statement | Output |
|---|---|
| {{#foreach matter.ledger.transactions}} | |
| {{details}} | The details given to the transaction |
| {{#datetime date}} | The date of the transaction |
| {{officeTax}} | The amount of VAT on the transaction |
| {{officeDebit}} | The amount debited from the Office account |
| {{officeCredit}} | The amount credited to the Office account |
| {{officeBalance}} | The resulting balance on the Office ledger |
| {{clientDebit}} | The amount debited from the Client account |
| {{clientCredit}} | The amount credited from the Client account |
| {{clientBalance}} | The resulting balance on the Client ledger |
| {{#endforeach}} |
Time Recording
Section titled “Time Recording”Use the following statements to output details of the matters time recording:
| Statement | Output |
|---|---|
| {{#foreach matter.timerecords}} | |
| {{#datetime date}} | The date of the recording |
| {{status}} | The recording’s current status |
| {{feeearner}} | The assigned Fee Earner |
| {{type}} | The type of time recording |
| {{notes}} | The details given to the time recording |
| {{rate}} | The rate given to the time recording |
| {{#calc 6* units}} minutes ({{units}} units) | The total amount of time recorded (the total amount of units recorded) |
| {{amount}} | The total amount of the time recording |
| {{#endforeach}} |