# Short Codes

The **Short Codes** button under "Tenant Settings" in the **Admin Dashboard** provides the ability to replace predefined strings or variables in a report with new values, reducing the need to edit each report. Using short codes makes report creation more efficient and reduces maintenance, as it reduces the time to edit.

Short codes can pull data from a report custom field or a client custom field, depending if the short code applies to all reports for a client or one specific report.

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FsOmy2W6bkaGNzTxgR0Kw%2Fimage.png?alt=media&#x26;token=91068379-8115-48ac-b2ab-7d0ec87a0885" alt=""><figcaption></figcaption></figure></div>

## Default Short Codes

PlexTrac provides six short codes that pull data from non-custom fields and are listed on the **Default** tab. These variables cannot be modified or deleted.

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2Fc3eLxFwyEvghoR5e1bvp%2Fimage.png?alt=media&#x26;token=ac31c020-ab68-4883-a802-61a2ff31596c" alt=""><figcaption></figcaption></figure></div>

| Short Code              | Source                                                                                                              |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------- |
| %%CLIENT\_NAME%%        | The name of the client, as defined in the Create/Edit Client modal of the **Clients** module.                       |
| %%CLIENT\_POC%%         | The POC for the client, as defined in the Create/Edit Client modal of the **Clients** module.                       |
| %%CLIENT\_POC\_EMAIL%%  | The client POC’s email address, as defined in the Create/Edit Client modal of the **Clients** module.               |
| %%REPORT\_NAME%%        | The report's name is defined in the "Report Name" field of the **Details** tab in the **Report** module.            |
| %%REPORT\_START\_DATE%% | The start date of the report, as defined in the "Start Date" field of the **Details** tab in the **Report** module. |
| %%REPORT\_END\_DATE%%   | The end date of the report, as defined in the "End Date" field of the **Details** tab in the **Report** module.     |

## Creating a Short Code

<mark style="background-color:yellow;">Step 1</mark>: From the **Custom** tab of the Short Codes page within the **Admin Dashboard**, click **Create Short Code**.&#x20;

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2F4ucLnhfpiL6jFQX4HdLh%2Fimage.png?alt=media&#x26;token=d1893b4f-a9b1-414e-acbd-8e2ae1d5f4bc" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 2</mark>: Enter the appropriate values in the provided fields.&#x20;

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FwdmuM6AhJdGzRjKY6csW%2Fimage.png?alt=media&#x26;token=de51b9b1-f0d6-4eca-aada-51a884720420" alt=""><figcaption></figcaption></figure></div>

1. **Short Code field:** The string inserted in reusable rich text fields that will be replaced after activation. Short Codes must follow the following rules:
   * Be a single string with no spaces
   * Begin and end with two percent symbols
   * No special characters other than an underscore and the aforementioned percent symbols
   * Follow the standard of `%%MY_SHORT_CODE%%` when “MY\_SHORT\_CODE” is the desired string
2. **Source field:** The value from which the short code is replaced and can originate from either a report or client custom field.&#x20;
3. **Custom Field Label field:** The value associated with the short code that will be entered in a client or report custom field to generate the replacement value. Below is an example of a short code's Custom Field Label value ("Client Domain") used in a report.

   <div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2Fe6nAuadRCSRKyXbi77Vs%2Fimage.png?alt=media&#x26;token=9138e870-9836-49b7-98ca-533c040b1db8" alt="" width="375"><figcaption></figcaption></figure></div>

{% hint style="info" %}
Report Custom Fields can be pre-populated from Report templates.
{% endhint %}

<mark style="background-color:yellow;">Step 3</mark>: Click **Save**.&#x20;

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FE778dGtoNQYcx7X6Rxgs%2Fimage.png?alt=media&#x26;token=38adba0b-c58c-4ecf-a423-70e5cb88291d" alt=""><figcaption></figcaption></figure></div>

The new short code is inserted at the bottom of the list on the **Custom** tab.&#x20;

<mark style="background-color:yellow;">Step 4</mark>: Use the [short code at the client level](https://docs.plextrac.com/plextrac-documentation/product-documentation/clients/using-short-codes-from-the-client-level-in-plextrac) for use in all reports for a client, or use the [short code within a specific report](https://docs.plextrac.com/plextrac-documentation/product-documentation/reports/short-codes).&#x20;

## Editing Short Codes

Custom Short codes can be modified by clicking **Edit** in the "Actions" column of the applicable short code.

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FUcySJgk7RQKS7ktm5bdb%2Fimage.png?alt=media&#x26;token=deda15a3-447d-4dbd-8300-fe750b156887" alt=""><figcaption></figcaption></figure></div>

## Deleting Short Codes

Custom short codes can be removed by clicking **Delete** in the "Actions" column of the applicable short code.

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FMLc5MRggzqBzP4WSIrih%2Fimage.png?alt=media&#x26;token=4e30fa0f-af1a-40af-b2f2-7c3f66692f09" alt=""><figcaption></figcaption></figure></div>

A modal will appear, confirming the action. Click **Confirm Delete**.
