> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upflow.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Add an Upflow payment link to NetSuite invoice PDFs

> Show a Pay via Upflow button on the invoice PDFs NetSuite generates, using the customer portal URL exported from Upflow and an Advanced PDF/HTML template.

You can add a **Pay via Upflow** button to the invoice PDFs that NetSuite prints and emails. Your customers click it to open their Upflow customer portal and pay online.

<img src="https://mintcdn.com/upflow-04dc27cd/OhhMXkCTJOKdTBbL/images/netsuite-pdf-link-printed-invoice.png?fit=max&auto=format&n=OhhMXkCTJOKdTBbL&q=85&s=f1f434013457a5c17a8021a9e7af562f" alt="A NetSuite invoice PDF with a purple Pay via Upflow button below the totals." width="640" data-path="images/netsuite-pdf-link-printed-invoice.png" />

## How it works

1. Upflow exports each customer's portal URL to a custom field on the NetSuite customer record.
2. A transaction body field copies that URL onto every new invoice for the customer.
3. Your invoice's Advanced PDF/HTML template shows the URL as a button, but only when the field has a value.

## Before you start

* NetSuite must be [connected to Upflow](/en-us/integrations/netsuite/connect).
* You need a NetSuite role with permission to create custom fields and edit transaction forms and Advanced PDF/HTML templates.
* Your invoice form must use **Advanced** printing, not **Basic**.

## Step 1: Create the customer field

1. In NetSuite, go to **Customization** → **Lists, Records, & Fields** → **Entity Fields** and click **New**.
2. Enter a **Label** that's easy to find later, such as `Upflow portal`.
3. Set **Type** to **Text Area**. Portal URLs are long, and a free-form text field can cut them off.
4. On the **Applies To** subtab, check **Customer**.
5. Click **Save**.

<img src="https://mintcdn.com/upflow-04dc27cd/OhhMXkCTJOKdTBbL/images/netsuite-pdf-link-entity-field.png?fit=max&auto=format&n=OhhMXkCTJOKdTBbL&q=85&s=b98f3b33cdf8c9887a4f6f0f621197e0" alt="The Custom Entity Field form in NetSuite with the label Upflow portal, type Text Area, and Customer checked under Applies To." width="640" data-path="images/netsuite-pdf-link-entity-field.png" />

## Step 2: Export the portal URL from Upflow

1. In Upflow, go to [**Settings** → **Integrations**](https://app.upflow.io/organization/-/settings/integrations) and scroll to **Export to NetSuite**.
2. Turn on the **Export to NetSuite** toggle if it isn't on already.
3. Add a row that maps the **Customer portal URL** Upflow field to the NetSuite field you created in step 1.
4. Click **Save**.

Upflow now writes each customer's portal URL to that field. For more details, see [Export Upflow data to NetSuite](/en-us/integrations/netsuite/export-data).

## Step 3: Create the transaction body field

This field copies the portal URL from the customer onto each invoice, so the PDF template can read it.

1. Go to **Customization** → **Lists, Records, & Fields** → **Transaction Body Fields** and click **New**.

2. Enter a **Label**, such as `Upflow portal display`.

3. Set **Type** to **Text Area**. It must match the type of the customer field.

4. On the **Applies To** subtab, check **Sale** and **Print on standard forms**.

   <img src="https://mintcdn.com/upflow-04dc27cd/OhhMXkCTJOKdTBbL/images/netsuite-pdf-link-body-field-applies-to.png?fit=max&auto=format&n=OhhMXkCTJOKdTBbL&q=85&s=e0c72289e8c0a595dda0e80aa234935a" alt="The Transaction Body Field form with type Text Area, and Sale and Print on standard forms checked." width="640" data-path="images/netsuite-pdf-link-body-field-applies-to.png" />

5. On the **Sourcing & Filtering** subtab:

   * Set **Source List** to **Entity**.
   * Set **Source From** to the customer field from step 1. Type `upflow` in the search box to find it quickly.

   <img src="https://mintcdn.com/upflow-04dc27cd/OhhMXkCTJOKdTBbL/images/netsuite-pdf-link-body-field-sourcing.png?fit=max&auto=format&n=OhhMXkCTJOKdTBbL&q=85&s=5bff55a1e472efa5f0202fc555ba6a12" alt="The Sourcing & Filtering subtab with Source List set to Entity and Source From set to Upflow portal." width="640" data-path="images/netsuite-pdf-link-body-field-sourcing.png" />

6. Click **Save**.

7. In the **Transaction Body Fields** list, find your new field and note its **ID**, for example `custbody10`. You need it in step 5.

## Step 4: Show the field on your invoice form

1. Go to **Customization** → **Forms** → **Transaction Forms** and click **Edit** next to the form your invoices use.
2. Note the **Print Template** and **Email Template** values. You'll edit these templates in the next step.
3. Open the **Screen Fields** subtab, then the **Custom** subtab.
4. Find the transaction body field from step 3 and check **Show**.
5. Click **Save**.

## Step 5: Add the button to your PDF template

1. Go to **Customization** → **Forms** → **Advanced PDF/HTML Templates**.

2. Click **Edit** next to the template your invoice form uses. If the print and email templates are different, repeat these steps for both.

3. Turn on **Source Code**.

4. Paste this snippet where you want the button to appear, for example just after the totals table. Replace `custbody10` with your field ID from step 3.

   ```html theme={null}
   <#if record.custbody10?has_content>
     <table style="margin-top: 20px;">
       <tr>
         <td background-color="#5b3cf5" corner-radius="10" style="padding: 8px 16px;">
           <a href="${record.custbody10}" style="color: #ffffff; font-weight: bold; text-decoration: none;">Pay via Upflow</a>
         </td>
       </tr>
     </table>
   </#if>
   ```

   The `<#if ... ?has_content>` check hides the button when the invoice has no portal URL. Without it, customers could see a button that doesn't work.

   If you prefer a plain text link, use this instead:

   ```html theme={null}
   <#if record.custbody10?has_content>
     <p><a href="${record.custbody10}">Pay this invoice online</a></p>
   </#if>
   ```

5. Click **Save**.

<img src="https://mintcdn.com/upflow-04dc27cd/OhhMXkCTJOKdTBbL/images/netsuite-pdf-link-template-code.png?fit=max&auto=format&n=OhhMXkCTJOKdTBbL&q=85&s=f16f9d697dad5e830d27443bc4706feb" alt="The Advanced PDF/HTML template editor in source code mode, with the conditional Pay via Upflow snippet after the totals table." width="640" data-path="images/netsuite-pdf-link-template-code.png" />

## Step 6: Test with a new invoice

The portal URL is copied onto an invoice when the invoice is created. Invoices that already exist, including ones you've already sent, don't get the link.

1. Create a new invoice for a customer whose portal URL has been exported from Upflow.
2. Make sure the invoice uses the form you edited in step 4.
3. Click **Print**. The PDF now shows the **Pay via Upflow** button, and clicking it opens that customer's Upflow portal.

## Good to know

* If the button doesn't appear, check that the customer record has a value in the customer field from step 1. Then check that the invoice was created after you finished the setup.
* The field ID in the template must match your transaction body field exactly, for example `record.custbody10`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.