How-toReviewed 2026-09-29

Design a new document template

Create a document template for a record type, write its wording with merge fields, repeat a table row for line items, show a block only when a condition holds, preview it against a real record and publish it so people can generate documents from it.

Design a new document template

A document template is a letter or form whose blanks fill themselves from a record: a booking, a demand, an estimate and so on. Design one when the six starter templates don't cover a letter you send, for example a no-objection letter for a buyer's home loan. You write it once, check it against a real record, and publish it; from then on anyone can generate it from that kind of record.

Before you start

  • Decide which record the letter is about (its Record type): the fields you can use come from it. The usual pairs are a demand letter on a Demand, a termsheet or offer letter on a Termsheet, an agreement or allotment letter on a Booking, a receipt on a Payment and a cost sheet on an Estimate.
  • To start from an existing template instead, click its copy icon ("Duplicate <name>") on the list, give the copy a new Code and Name and click Duplicate; then continue from step 6.
  • A letterhead is optional but gives the letter its branding.
  • To preview, you need at least one record of the record type and the View permission on its module.
  • The Record type list is filled only for people who also hold the View permission on Workflow Rules. Without it the list is empty and the template stays on Demand unless the "Use the usual record type for a …" link appears and you click it.
  • Permissions, in the role editor's words, on Document Templates: View, Create (new template), Edit (save the draft) and publish (publish it). In the default roles the Administrator, the Sales Manager and Legal & Documentation hold all four.

Steps

  1. Open the account menu in the top bar, choose Settings, then Documents > Templates. See Document templates.
  2. Click New template. The dialog "New document template" opens.
  3. Type the Code, for example "BANK_NOC" (capital letters, digits and underscores; what you type is turned into capitals), and the Name, for example "NOC for home loan".
  4. Pick the Kind and the Record type, for example Other and Booking. The kind sets the document number prefix (the hint reads "Sets the number prefix (DL, TS, AGR, AL, RC, DOC)."; an offer letter gets OL and a cost sheet CS). If the link "Use the usual record type for a <kind> (<record type>)" appears, click it to take the usual pair. The designer has no field for the record type, so it can't be changed afterwards.
  5. Click Create and open. The template designer opens on the new template, in Draft, with a short starter letter ("Dear {{ contact.first_name }}, … Regards, {{ organization.name }}") and the bar "Drafts cannot be used yet. Publish the template to offer it on <record type> records and in workflows." See Document template.
  6. In Details, choose the Letterhead (or leave "Default letterhead (project's, else the organization's)"), type the Document title, which also becomes the file name, for example "NOC {{ entity.booking_no }} – {{ contact.name }}", and a Description for the list. Leave Number prefix blank to use the kind's usual prefix. An amber Unsaved changes badge appears next to the name.
  7. If the defaults don't suit, click Page settings (size, margins, font) and set Page size, Orientation, Font, Font size (pt) and the margins. They start at A4, Portrait, Noto Sans, 20 mm top and bottom and 18 mm left and right, with Page numbers on.
  8. Write the wording in Body. To fill in a value, put the cursor where it belongs and click the field in the Merge fields list on the right ("Search fields…" finds it), or use {{ }} Field in the toolbar. It goes in as an expression such as {{ contact.name }}; amounts are inserted with Indian grouping and dates as dates.
  9. For a table of line items, insert a table with the toolbar's table tool, put the cursor in the row that should repeat and click Repeat row. In "Repeat table row" pick the list in Repeat over ("Choose a list…"; a booking offers lists such as its payments and schedule), keep Row name as "row" and click Insert. Then fill the row's cells with the list's fields, written {{ row.<field> }}. One row prints per item.
  10. For a block that applies only sometimes, put the cursor in the paragraph, table or list, click Show when, type the condition ("Examples: entity.tds_amount > 0, contact.pan_no, entity.status == "Issued".") and click Insert. The block prints only when the condition holds.
  11. Click Save draft. You see "Template saved." and the Unsaved changes badge goes.
  12. In the Preview panel, search for a real record ("Search <record type> records…"), pick it and click Preview. The page renders for that record, numbered "<prefix>-PREVIEW", with the line "<title> · <size> <orientation> · <letterhead>" above it. Click Open PDF to check page breaks and margins as they will print. Nothing is saved and no number is used. Fix anything that prints blank, save again and preview again.
  13. Click Publish. The dialog "Publish template" reads "The draft is snapshotted as version 1. Documents generated from now on use it; earlier documents keep the version they were made with." (with unsaved edits it starts "The draft is saved first, then snapshotted as version 1."). Add Notes (optional) ("What changed in this version") and click Publish. You see "Published as version 1." and the status becomes Published.

What happens next

  • The template is offered under Generate document on every record of its type, and to workflow rules. See Generate a document from a record.
  • Documents are numbered <prefix>-<financial year>-nnnnn, for example DOC-2026-27-00001, one series per prefix, starting again each 1 April. Two templates with the same prefix share one series.
  • Later edits are saved as a draft and don't reach anyone until you publish them as a new version. See Revise, retire or reopen a published template.

If something goes wrong

  • A field prints blank in the preview: the name is misspelt or the record has no value. The app doesn't flag unknown fields, so always preview against a real record before publishing.
  • "body_html: <problem> (line <n>)" (or "header_html", "footer_html", "title_template") when saving: a merge tag is broken; View HTML shows the line. "The HTML exceeds 500 KB": remove large pasted images. "Choose what to repeat over.", "Put the cursor inside a table row first.", "Write a condition." or "Put the cursor inside the block to wrap." in the merge dialogs. "Template could not be rendered: <error>" or "PDF could not be produced: <error>" in the preview. "Please correct the highlighted fields." when publishing an empty body. See Template will not save, publish or render (trouble.documents.template-syntax-error).
  • "A template with this code already exists (codes are never reused).": choose another code. See Already exists (trouble.admin.already-exists).
  • "Code is required", "Use letters, digits and underscores only", "Name is required" or "Choose the record type": complete the dialog.
  • A preview message starting "Missing permission", or no New template, Save draft or Publish button: your role lacks a permission listed above, or the View permission on the record's module. See No access (trouble.admin.no-access).

Related

  • Document templatesScreen

    The list of your organization's document templates (demand letters, offer letters, termsheets, agreements, allotment letters, receipts, cost sheets), with filters and the actions to create, duplicate, open or delete one.

  • Document templateScreen

    The template designer: write a template's wording with merge fields, set its letterhead, title and page layout, preview it against a real record, and publish, retire or restore its versions.

  • LetterheadsScreen

    Set up the branding wrapped around generated documents: logo, header and footer, page size, orientation, margins and page numbers, for the whole organization or for one project.

  • Generated documentsScreen

    The organization-wide log of every document generated from a template or uploaded against a record, where you preview, download, email, void or delete them.

  • Set up a letterheadHow-to

    Create the organization's default letterhead with its header, footer, page size and margins, upload the logo, and optionally add a project's own letterhead, so generated letters carry your branding.

  • Put a starter document template into useHow-to

    Review one of the six starter templates that come as drafts, preview it against a real record, publish it, and switch on the system workflow rule that sends it automatically.

  • Revise, retire or reopen a published templateHow-to

    Change a published document template without disturbing the version in use, publish the changes as a new version, go back to an earlier version, and take a template out of use or bring it back.

  • Generate a document from a recordHow-to

    From a booking, demand, opportunity, estimate or offer, pick a published template and a format, generate the numbered document, check it on screen and download it; every document is also listed in the organization-wide Generated documents log.

  • Document templates, published versions and letterheadsConcept

    A document template is an HTML letter with merge fields written for one record type; publishing it freezes a numbered version that generation uses while the draft stays editable, and a letterhead (the template's own, else the project's, else the organization's default) supplies the logo, header, footer and page layout around it.

  • Merge fields and filtersConcept

    Merge fields are the double-brace placeholders in document and message templates ({{ entity.demand_no }}, {{ contact.name }}) that are replaced with the record's values when a document or message is rendered; filters such as inr, words and date format the value, and Repeat row / Show when add tables and conditional blocks.

  • Numbers and series: documents, bookings, demands, payments and vouchersConcept

    How NirmaanOne numbers what it creates: generated documents, bookings, demands, demand runs, payments, payout runs and revenue runs take a prefix, the Indian financial year and a five-digit serial (BK-2026-27-00007), while vouchers are numbered on posting from their voucher type's prefix, padded counter and suffix.

  • Template will not save, publish or render: a tag, expression or the HTML is wrongTroubleshooting

    A document template, message template or rule action that carries a broken merge tag is refused when saved or published, names the field and the line; a template that parses but fails while filling in a record, or whose HTML the PDF or Word engine cannot lay out, fails at preview, generation or sending; the editor's own dialogs and fields have their own checks.

  • Generate document has nothing to offer: no published template for this record typeTroubleshooting

    Documents are generated only from published document templates of the record's type; the starter templates (cost sheet, allotment letter, offer letter and others) ship as drafts, so until someone publishes one, Generate document has nothing to pick, offers issue without a letter and workflow rules that generate the template fail.

  • "Already exists" or "listed twice": the name, code, number or line must be uniqueTroubleshooting

    Names, codes and numbers are unique within their scope (the organization, a project, a tower, a set of books) so that records can be told apart, and a line can appear once on a plan, offer or account; rename, reuse the existing record, or remove the duplicate line.

  • "No access" or "You do not have permission": your role lacks a permissionTroubleshooting

    Every screen, button and picker is gated by a permission on a module; your role decides which you hold, so a missing one shows as a No access card, a refused action, a greyed-out button with a hover reason, or a picker that explains which permission it needs.