# Data aliases

{% hint style="info" %}
To understand this topic, you'll need to first complete Lesson 3 of the Cluck University course Automation Basics. This will introduce you to JSON and teach you how to both understand and use JSON in Rewst. If you haven't done your coursework yet, start there, then come back to this document.
{% endhint %}

## **What are Data aliases?**&#x20;

A *data alias* is a shortcut that extracts specific pieces of information from a JSON response and stores them in an easy-to-use *variable*. Instead of navigating the entire JSON structure every time, a data alias pulls out exactly what you need—like a user’s name or email—and makes it accessible throughout your workflow. Think of data aliases as custom labels you assign to specific data.

Recall that *the context* is where all data generated, captured, or used in a workflow is stored. Think of it as a shared memory for a specific workflow. Data aliases are stored in the context, making them available for reuse at any step in your workflow without re-fetching the data.&#x20;

For example, imagine that you've set up your Microsoft Graph integration. You send a request via API call to get info about a user. The response comes back to you in JSON format, which can be lengthy and time consuming to search through. A data alias would let you get all of the information, or pinpoint specific information like the user's name or email address, and store it in a simpler variable in the context for use.&#x20;

Together, variables, data aliases, and the context make your workflows in Rewst more efficient, organized, and adaptable. These tools help you reuse workflows, reduce manual work, and customize data handling to fit any automation need.

### Data alias requirements

When adding a new data alias, you'll need the following:

* **Key**: The name you assign to specific data.
* **Value**: The actual data it corresponds to. The code editor button allows for the use of Jinja customization for intricate data or expressions.

### Data alias context example

If you set an alias such as `my_task_result -> {{ RESULT }}`, later tasks can refer to this data using `{{ CTX.my_task_result }}`.

You can also use a data alias to extract specific information and manipulate data. Expanding on our example from above, take the input from the Microsoft Graph get user action and extract the user's name and user principal name for ease of use.<br>

1. Drag the **Get User** action onto the workflow builder canvas.
2. Add your user into the **User ID** field.
3. Set your context variable name under **Publish Result As.** The workflow action results will be stored as the value.<br>

   <figure><img src="https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2FC2pvlW0495v8nyfDAh3D%2Fimage.png?alt=media&#x26;token=3ba20b09-913b-43ae-aa81-c5c829cd7bb4" alt=""><figcaption></figcaption></figure>
4. Add your data alias name. Click ![](https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2F3NTXxFUwYFhXgM4iE1bw%2FScreenshot%202025-03-13%20at%205.55.52%E2%80%AFPM.png?alt=media\&token=bedfd7e1-684f-4a8a-82b0-bce83480044c)to open the Jinja editor and set up your data alias.

   <figure><img src="https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2FIJqVEZ57uuJHyLUVFifv%2Fimage.png?alt=media&#x26;token=c5d3ff77-800e-4935-afea-2782232dbb5c" alt=""><figcaption></figcaption></figure>
5. Use the following Jinja to create a new dictionary object and set the `displayName` and `userPrincipalName` keys.<br>

   ```
   {{
   {
   "displayName": CTX.user_details.data.value.displayName,
   "userPrincipalName": CTX.user_details.data.value.userPrincipalName
   }
   }}
   ```
6. Run the workflow. Then, click **View Results**
7. Click **Load Context.**
8. Expand the context to see our data alias `filtered_user_details` now only showing the `displayName` and `userPrincipalName` .

   <figure><img src="https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2F6Qp63EasKomv1Od0A6Cq%2Fimage.png?alt=media&#x26;token=f42feeaa-7400-4fd4-9f22-422eb0bd7a6f" alt=""><figcaption></figcaption></figure>

## Add a data alias to a workflow

Data aliases are added via transitions. See more about how to use [transitions in workflows here](https://docs.rewst.help/~/revisions/VmxzEdeNWvX54TqYxxOB/documentation/automations/workflows/task-transitions).

<figure><img src="https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2FGM0Ks0yueKIix8RAFBHb%2FScreenshot%202025-03-24%20at%2011.21.18%E2%80%AFAM.png?alt=media&#x26;token=162624bc-2397-4178-a21e-fc63e0a5e510" alt=""><figcaption></figcaption></figure>

1. Click ![](https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2FTAxj5Xzb0IqBFTJDOjmI%2FScreenshot%202025-03-24%20at%2011.22.42%E2%80%AFAM.png?alt=media\&token=db32038c-4337-4044-8058-77dd4a044471)to add your data alias.
2. Paste the key into the **key** field. Click ![](https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2F3NTXxFUwYFhXgM4iE1bw%2FScreenshot%202025-03-13%20at%205.55.52%E2%80%AFPM.png?alt=media\&token=bedfd7e1-684f-4a8a-82b0-bce83480044c)to open the Jinja editor and set up your data alias.
3. Click ![](https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2FFGKbMGoliLF1b6bBX7bq%2FScreenshot%202025-03-24%20at%2011.27.05%E2%80%AFAM.png?alt=media\&token=52cf2092-134f-4404-b095-66b4ff123800)to remove a data alias.
4. Click ![](https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2FketKMbKy7PwPtAw66MN7%2FScreenshot%202025-03-24%20at%2011.27.26%E2%80%AFAM.png?alt=media\&token=c84619ed-d9ab-47b6-a868-b805b6b05b64) and ![](https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2FWznhs5gUzecqhTDpzhms%2FScreenshot%202025-03-24%20at%2011.27.45%E2%80%AFAM.png?alt=media\&token=265eb9f9-a6d1-4128-8010-93a4709a91ad)to move multiple data aliases up and down in the data alias list.

## Access data aliases in a workflow

1. Navigate to **Automations > Workflows**.
2. Search for your desired workflow.&#x20;
3. Click **>** to the far right of that workflow to open its workflow builder canvas. \ <br>

   <figure><img src="https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2FCRJM464I5PNj7iuPsuyc%2FScreenshot%202025-03-06%20at%204.39.51%E2%80%AFPM.png?alt=media&#x26;token=bf6c3f14-150c-453f-b546-684f5234a0d0" alt=""><figcaption></figcaption></figure>
4. Click <img src="https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2FpDph0fRoxGUZqo0Fj8uq%2FScreenshot%202025-03-05%20at%202.42.21%E2%80%AFPM.png?alt=media&#x26;token=f8758c8b-21f8-4c65-a85e-c28a79dc5017" alt="" data-size="line"> to open the **Data Aliases** menu. This will display a complete list of all data aliases for that workflow.
