How export templates work
With export templates (eksportmaler) you decide exactly what a file from Project Flow looks like, so it can be imported into a system Project Flow has no ready-made export for, such as an accounting or payroll system. You write the template once, and Project Flow fills it with data each time you export.
- Invoices to accounting: through the integration Export Template (Eksportmal). This is the only use that needs an integration.
- Hours, absences and salaries: from Company → Timesheet status.
- Expenses: from the travel and expense report.
- Customers and projects: from the customer and project reports.
Advanced feature. Templates are written in a template language (Apache FreeMarker). Some technical knowledge is needed, and you should have a description or an example of the file the other system expects. Project Flow also provides ready-made templates (Maler fra Project Flow) you can start from.
Create a template
Go to Setup → Settings → Export templates (Oppsett → Innstillinger → Eksportmaler). You need administrator access.
- In the template selector at the top right, choose Create template (Opprett mal) to start from scratch, or a template under Global templates (Maler fra Project Flow) to start from one of Project Flow's.
- Fill in the fields below.
- Click Save. The template is now listed under Custom templates (Tilpassede maler).
Global templates can't be changed or used directly. When you save one, Project Flow creates your own copy. Give it a name that is easy to recognize, because that name is what you choose when you export.
Template fields
| Field (EN / NB) | Description |
|---|---|
| Template name / Malnavn | The name you choose from when you export. Required. |
| Datatype to export / Datatype som skal eksporteres | Which data the template uses, see the next table. Required. |
| File name / Filnavn | The name of the exported file, without extension. Required. You can use {DATETIME} for the date and time of the export, or {COMPANY_CODE} for your company code. |
| File type / Filtype | The file extension: txt (default), csv, html, xhtml, xml, rtf, hlw, si, dta or tlu. With xml you can add an XML schema, and the file is checked against it. With html/xhtml you get a field for CSS. |
| Decimal separator / Desimal separator | Comma (default) or dot. |
| Linebreak / Linjeskift | Windows (default) or Linux. |
| Quotes / Anførselstegn | Quotes around text values: single (default), double or none. Only used when File type is csv. |
| If empty field. Use quotes? / Hvis tomt felt, sett inn anførselstegn? | Whether empty text values also get quotes. Default yes. |
| Encoding / Koding | UTF-8 (default) or ISO-8859-1. |
| Content / Innhold | The template itself, see Write the content. Required. |
Datatypes
| Datatype (EN / NB) | Used for |
|---|---|
| Invoices / Fakturaer | Invoices with their lines, for the Export Template integration. |
| Invoices grouped by account | Invoice amounts added together per bookkeeping account. |
| Timerecords / Timeføringer | One row per time record. |
| Timerecords (grouped) / Timeføringer (gruppert) | Hours added together per co-worker and salary code, for payroll. |
| Absences / Fravær | Absences. |
| Salaries / Lønn | Time records with salary codes, for payroll. |
| Expenses (travel) / Utlegg (reiseregninger) | Expense lines from travel and expense claims. |
| Customers / Kunder | Customers. |
| Projects / Prosjekter | Projects, with customer, address and contact. |
| Co-workers / Medarbeidere | Co-workers. |
There are also datatypes made for specific payroll systems, such as Hogia Payroll, Timerecords Visma Lön 600, FlexLon time records and Fortnox PAXml. Use them with the matching global template.
Write the content
The Content field uses Apache FreeMarker, so you can use lists, conditions (<#if>) and your own functions (<#function>). In addition, Project Flow has its own field syntax #{…}. It uses the template's decimal separator and quotes automatically, and writes nothing for empty values.
Example: one line per invoice line, with invoice number, date, account and amount.
<#list invoices as i>
<#list i.invoiceLines as l>
#{i.invoiceNumber};#{i.issueDate?dd.MM.yyyy};#{l.financialAccountNumber};#{l.sumNetAmount?0.00}
</#list>
</#list>| Syntax | What it does |
|---|---|
<#list invoices as i> | Repeats the content for each record. The list is named after the datatype: invoices, timeRecords, absences, salaries, claimEntries, customers, projects, userAccounts. |
#{i.issueDate?dd.MM.yyyy} | A date in the format you give. Without a format, dates are written yyyy-MM-dd. |
#{l.sumNetAmount?0.00} | A number with the given number of decimals. |
#{x?leftPad(10)} / #{x?rightPad(10,"0")} | Pads the value to a fixed width, with spaces or the character you give. Useful for fixed-width files. |
#{x?noquote} | Writes a text value without quotes. |
sysDate, company, user | Today's date, your company and the user running the export, for use in headers. |
- Available fields: after you have chosen a datatype, click Available fields (Tilgjengelige felter) under the form to see every field you can use.
- Date formats: the link Date & time formatting shows the date patterns you can use.
- Payroll codes: in Timerecords (grouped), the salary code is taken from the overtime category's External salary code (Ekstern lønnskode), otherwise from the default external salary code in the settings. Only co-workers with an External employee number (Eksternt ansattnummer) are included.
Test the template
For a saved custom template, click Test template (Test mal). Project Flow runs the template on the 10 newest records of the datatype and shows the result in Template output.
- Save first. Only saved changes are tested.
- Test often while you add fields or functions. Errors in the content aren't found when you save, only when you test or export.
- Empty result? The template probably has an error, for example a field name that doesn't exist for the datatype. Check the field names against Available fields.
Deleting a template. A template used by an Export Template integration can't be deleted: "Cannot delete this template because it is used in integrations".
Export invoices to accounting
To export invoices with your template, you add the integration Export Template.
Set up the integration
- Create a custom template with the datatype Invoices or Invoices grouped by account.
- Go to Setup → Settings → Integrations and switch to the tab Export to file (Eksport til fil).
- Click + Create integration and choose Export Template.
- Choose your template in Export template (Eksportmal), fill in the fields below, tick Enabled and save.
Several templates. You can add up to three Export Template integrations, each with its own template. In the list of integrations they are shown with the template's name.
Project Flow plan. The integration isn't available on the Start plan.
| Field (EN / NB) | Description |
|---|---|
| Export template / Eksportmal | The custom invoice template to use. Required. |
| Default invoice issue date limit / Standard sluttdato for fakturaeksport | Which invoices are included, by invoice date: Up to and including last day of previous month, Current date, or No limitations on date (everything that hasn't been exported yet) (default). |
| Send data to / Send data til | Download folder (default), Email, FTP / FTPS (also SFTP) or HTTP / HTTPS. |
| Transfer files / Send over filer | Only for FTP and HTTP. Manually, or Continuously (after each invoice finalization). |
| Define access / Definer tilgang | Only for manual transfer. Limit who may run the export, by access role or co-worker. |
Fields for each sending method:
- Email: recipient addresses (separated by semicolons), subject and message.
- FTP / FTPS / SFTP: type, host, port (for example
21, or usually22for SFTP), username, password and the directory to put the file in. - HTTP / HTTPS: the URL, username and password.
Run the export
- When there are invoices to export, Export to accounting (N) (Eksport til regnskap) appears in the notifications menu (the bell). You need permission to edit invoices, and must be on the access list if one is defined.
- Click it. The window lists the Invoices to be exported.
- Click Export. You see "Data export succeeded". With Download folder, the file is downloaded right away.
- Which invoices: finalized invoices and credit notes with the export status To transfer and an invoice date within the date limit. Customers and projects aren't exported.
- After the export: the invoices get the export status Has been transferred (Har blitt overført), so they aren't exported again.
- Export again: in the invoice overview, open the cog menu, choose Edit export status for several invoices and set the invoices back to To transfer.
- Earlier files: in the invoice overview, open the cog menu and choose Exported files (Eksporterte filer).
- Continuous transfer: each invoice is sent by FTP or HTTP when it is finalized. There is no bell entry in this mode.
Export hours, absences and salaries
Go to Company → Timesheet status (Selskap → Timelistestatus). The box Export hours using export template (Eksporter timer ved bruk av eksportmal) appears when you have a custom template with the datatype Timerecords, Timerecords (grouped), Absences or Salaries.
- Choose the Export template.
- Choose From date and To Date. The default is last month.
- Tick the options you need (see below), and click Create export file (Opprett eksportfil).
| Option (EN / NB) | Description |
|---|---|
| Include external co-workers / Inkluder eksterne medarbeidere | Also include external co-workers. Off by default. |
| Only export hours registered on overtime categories / Kun eksporter timer som er registrert på overtidskategorier | Leave out ordinary hours. |
| Include accumulated hour balance / Inkluder opparbeidet timebalanse | Shown only when Hour balance external salary code (Lønnsart for timebalanse) is set. |
| Only include absence that has been approved | For Absences templates. On by default. |
| Only include time records that has been approved | For Salaries templates. On by default. |
- Approval: templates of the type Timerecords and Timerecords (grouped) include all hours in the period, approved or not. Make sure the period is complete and approved before you export.
- Export as often as you like. The export doesn't change the hours. Project Flow only records the date in the Latest export (Siste eksport) column for each co-worker.
- Limit: one export can hold up to 50,000 records. For more, choose a shorter period.
Export expenses
Go to the travel and expense report (My pages → Travel & Expense → Report), open the cog menu and choose Export using export template (Eksporter ved hjelp av eksportmal). You need a custom template with the datatype Expenses (travel).
- Choose the template, and a From and To date. The dates are the date the claims were submitted.
- Tick Set status to 'paid out' after the export if the claims should be marked as paid out.
- Tick Include claims marked as 'paid out' to also export claims already paid out.
- Click Export.
- Included: claims with the status Approved, from co-workers with an External employee number.
- Not included: expenses paid by the employer.
"Set status to 'paid out'" applies to all approved claims in the period, also those left out of the file, for example because the co-worker has no external employee number. Check that all co-workers have an external employee number before you use it.
Export customers and projects
Go to Customers → Report or Projects → Report, open the cog menu and choose Export customers or Export projects. The option appears when you have a custom template with the datatype Customers or Projects. For projects, only templates with the file type csv are listed.
Choose the Template and a From date, and click Export. The from date selects:
- Customers: created on or after the date, or with hours, invoices, expenses or product sales on their projects from that date.
- Projects: with hours, invoices, expenses or product sales from that date. A new project without any registrations isn't included.
Q&A
Q: I can't edit a template.
A: It is a global template. Save it to get your own copy under Custom templates, and edit that.
Q: My template isn't in the list when I export.
A: Check two things:
- It is a custom template, not a global one.
- It has the right datatype for that export, for example Invoices for the Export Template integration.
Q: "Test template" shows an empty result.
A: Check the field names against Available fields, and that you saved before testing. The test only uses the 10 newest records, so a list can also be empty if those records don't have the data.
Q: Co-workers are missing from the payroll file.
A: Templates of the type Timerecords (grouped) and Expenses only include co-workers with an External employee number. Fill it in on the co-worker. External co-workers also need Include external co-workers.
Q: The numbers have the wrong decimal separator.
A: Change Decimal separator on the template. It only applies to values written with #{…}, not with FreeMarker's ${…}.
Q: I need to export invoices again.
A: Set them back to To transfer with Edit export status for several invoices, or download the earlier file from Exported files.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article