# Templating

Within organization settings, barcode label templates can be defined for inventory, runs, or locations.

<figure><img src="/files/CJHDe0fzhwnVqIlkPFI0" alt=""><figcaption></figcaption></figure>

Many templates can be defined per a type of object (i.e. inventory). This is handy for differing purposes - you might have a shipping label that is different from the one that is used for internal part movement. Or maybe you have a really small barcode label with just a barcode that gets used for smaller parts.

The template uses ZPL(Zebra Programming Language), which is the language of Zebra printers and is also used by other printers as well. This may look difficult to understand, but it's quite easy to get a hang of the basics for creating new labels. There is also an open source service named [Labelary](http://labelary.com/viewer.html) that can be used to render your templates to get the sizing and spacing correct.

Templates use variables specified with a syntax that looks like this: `${serialNumber}`. These are used to inject variables into the label template. A full list of variables available are shown to the left of the template in ion.

NOTE:  Some variables reference values on the object that are calculated.  For example, **earliestRunId** is available when creating a barcode label for a part inventory, and provides the id for the first created run associated with that inventory. If the inventory has been split (one or more times) since its creation, earliestRunId will reference the first created run of the original inventory from which it was originally split.

An example of a label template is shown below:

![](/files/QYfoRJdg94PLCxUgzWLL)

During the print process, when data is injected, the actual label will looks something like:

![](/files/QGQaIWML08VWNfWSvEuV)

#### Template Option: `earliestRunId`

The earliestRunId property is available when generating barcode labels for part inventories. This property provides a direct reference to the first run associated with that inventory, ensuring consistent traceability from the point of origin.

* Primary Runs: If the inventory has one or more runs directly linked to it, `earliestRunId` is set to the run created first (based on creation date).
* Split Inventories: If the inventory has been split one or more times, `earliestRunId` will reference the first run from the original inventory, again based on creation date.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.firstresonance.io/features/barcode-labels/templating.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
