> For the complete documentation index, see [llms.txt](https://docs.yansalabs.com/barcode-and-qr-code-generator/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yansalabs.com/barcode-and-qr-code-generator/technical-docs/using-a-barcode-label/attach-to-record.md).

# Attach to Record

## From Script:

### **Attach Label to Record - Automated (Server-side) -** Attach a barcode label to a record via automation or background process:

1. Include the code below in any area where server-side scripting is allowed:

```javascript
var barHelper = new x_yala_bargen.BarcodeGeneratorHelper();
barHelper.saveBarcodePDF(barcodeID, tableName, recID, destTable, destID, true);
```

* **barcodeID**: SysID of the **Barcode Generator** record to use for barcode generation
* **tableName**: Table of the record being referenced for barcode generation
* **recID**: SysID of the record being reference for barcode generation
* **destTable**: Table where the resulting PDF should be attached
* **destID**: SysID of the record to which the resulting PDF should be attached

{% hint style="info" %}
This option utilizes server-side barcode generation. The resulting file type is PDF.
{% endhint %}

### **Attach Barcode to Record - Automated (Server-side) -** Attach a barcode part to a record via automation or background process:

{% hint style="info" %}
This method attaches a **Barcode Part**, not an entire **Barcode Generator** label.
{% endhint %}

1. Include the code below in any area where server-side scripting is allowed:

```javascript
var barHelper = new x_yala_bargen.BarcodeGeneratorHelper();
barHelper.saveBarcodeSVG(barPartID, tableName, recID, destTable, destID);
```

* **barPartID**: SysID of the **Barcode Part** record to use for barcode generation
* **tableName**: Table of the record being referenced for barcode generation
* **recID**: SysID of the record being reference for barcode generation
* **destTable**: Table where the resulting SVG should be attached
* **destID**: SysID of the record to which the resulting SVG should be attached

{% hint style="info" %}
This option utilizes server-side barcode generation. The resulting file type is SVG.
{% endhint %}

## From Form:

### **Attach Label to Record from Label Button - Attach a barcode label using the built-in Attach button:**

1. Enable the 'Attachable' option on the **Barcode Generator** record for the desired barcode label
2. Any place where the in-browser view of the barcode label is enabled (form, dialog box (modal), ui page, widget), the 'Attach' button can be clicked to attach the barcode label to a record.

<figure><img src="/files/eYsFNNBGtdWtKIhAjaZE" alt="" width="266"><figcaption><p>Attach Label</p></figcaption></figure>

{% hint style="info" %}
All options to attach barcode labels from label utilize client-side barcode generation. The resulting file type is PNG.
{% endhint %}

### **Attach Label to Record from Form Button (Server-side) -** Attach a barcode label to a record via a button click w/ server-side barcode generation:

1. Visit **Barcode & QR Code Generator -> UI Actions** in the left nav. Locate and open the UI Action titled 'Test Attach Barcode (Server)'.
2. Update the **Name** and **Table** fields to match the table where you wish to place the button that will open the page. Following the instructions in the commented code, update code values to accommodate your needs. Insert and Stay to create a new record.

{% hint style="info" %}
This option utilizes server-side barcode generation. The resulting file type is PDF.&#x20;
{% endhint %}

<div><figure><img src="/files/vaBJEPUyf6CCrxBU4ZOv" alt=""><figcaption><p>Attach from Form (Server)</p></figcaption></figure> <figure><img src="/files/XSbEEdXgkAz6SMvVoOoL" alt=""><figcaption><p>PDF Attachment</p></figcaption></figure></div>

### **Attach Label to Record from Form Button (Client-side) -** Attach a barcode label to a record via a button click w/ client-side barcode generation:

1. Visit **Barcode & QR Code Generator -> UI Actions** in the left nav. Locate and open the UI Action titled 'Test Attach Barcode (Browser)'.
2. Update the **Name** and **Table** fields to match the table where you wish to place the button that will open the Dialog box. Following the instructions in the commented code, update code values to accommodate your needs. Insert and Stay to create a new record.

{% hint style="info" %}
This option utilizes client-side barcode generation. The resulting file type is PNG.
{% endhint %}

<div><figure><img src="/files/4QdjvGSk4auvRtLWvubr" alt=""><figcaption><p>Attach from Form (Browser)</p></figcaption></figure> <figure><img src="/files/6GTvKlKzz0JfIrke52zp" alt=""><figcaption><p>PNG Attachment</p></figcaption></figure></div>

### **Attach Barcode to Record from Form Button (Server-side) -** Attach a barcode part to a record via a button click w/ server-side barcode generation:

{% hint style="info" %}
This method attaches a **Barcode Part**, not an entire **Barcode Generator** label.
{% endhint %}

1. Visit **Barcode & QR Code Generator -> UI Actions** in the left nav. Locate and open the UI Action titled 'Test Attach Barcode Part (Server)'.
2. Update the **Name** and **Table** fields to match the table where you wish to place the button that will open the page. Following the instructions in the commented code, update code values to accommodate your needs. Insert and Stay to create a new record.

{% hint style="info" %}
This option utilizes server-side barcode generation. The resulting file type is PDF.&#x20;
{% endhint %}

<div><figure><img src="/files/0vpF2acdqdWCWYxBPrhs" alt=""><figcaption><p>Attach from Form (Server)</p></figcaption></figure> <figure><img src="/files/T93N5gziDh9oyZF55vlf" alt=""><figcaption><p>SVG Attachment</p></figcaption></figure></div>

## From List:

### **Attach Label to Record from List Choice -** Attach barcode labels via a list choice:

1. Visit **Barcode & QR Code Generator -> UI Actions** in the left nav. Locate and open the UI Action titled 'Test Attach Barcodes (List)'.
2. Update the **Name** and **Table** fields to match the table where you wish to place the list choice. Following the instructions in the commented code, update code values to accommodate your needs. Insert and Stay to create a new record.
3. Visit the list view of the specified table, check as many options as desired from the list, and then click the specified UI Action from the drop-down menu. This will trigger an attachment of the barcode labels to the specified records.

<figure><img src="/files/YHWHr8GvdnkXXRjHSGzO" alt=""><figcaption><p>Attach from List</p></figcaption></figure>

{% hint style="info" %}
This option utilizes client-side barcode generation. The resulting file type is PNG
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.yansalabs.com/barcode-and-qr-code-generator/technical-docs/using-a-barcode-label/attach-to-record.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
