---
title: "Directory Sync Data Transformation"
slug: "transforming-directory-field-data-using-liquid-and-regex"
description: "Learn how to reformat directory data before it appears in Opensense email signatures using regex transforms and Liquid. Covers phone number formatting, name order, case standardization, character removal, and how to choose the right approach for each scenario."
updated: 2026-03-18T19:27:03Z
published: 2026-03-18T19:27:03Z
canonical: "help.opensense.com/transforming-directory-field-data-using-liquid-and-regex"
---

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

# Directory Sync Data Transformation

## Overview

Field transformations let you reformat data from your directory before it appears in email signatures without changing anything in your identity provider. This is useful when your directory stores data in a format that differs from how it should be displayed, such as unformatted phone numbers or names stored in last-first order.

Transformations apply to directory-synced data only. Values entered manually through custom compose fields are not affected.

## What you can do

### Phone number formatting

| Input example | Output format |
| --- | --- |
| `6043334567` | `(604) 333-4567` |
| `604-333-4567` | `604.333.4567` |
| `6043334567 x1234` (with extension) | `604.333.4567` |
| Any format stored in AD | `604.333.4567` OR `604-333-4567` |

### Text formatting

| Transformation | Input example | Output example |
| --- | --- | --- |
| Flip name order | `Doe, Jane` | `Jane Doe` |
| All uppercase | `jane doe` | `JANE DOE` |
| All lowercase | `JANE DOE` | `jane doe` |
| Remove specific characters | `Director - Sales` | `Director` |
| Trim whitespace | `[space] Jane Doe` | `Jane Doe` |

## Two approaches

Transformations can be configured using either **regex transforms** or **Liquid**, depending on what you need.

### Regex transforms

Regex transforms are configured in the Transforms panel under each field mapping. Steps run in sequence, with each step receiving the output of the previous one. Built-in keywords handle common operations without needing to write custom patterns:

- **formatPhone** — normalizes digits into a standard phone format
- **flipNameComma** — converts "Last, First" to "First Last"
- **toUpperCase** / **toLowerCase** — changes case
- **trim** — removes leading and trailing whitespace
- **space** — inserts or matches a literal space

### Liquid

Liquid is entered directly in the Source field and handles scenarios that regex transforms are not suited for — such as removing or replacing specific characters, conditional logic, fallback values when a field is empty, or custom string manipulation beyond what the built-in keywords support.

## Which approach to use

| Scenario | Use |
| --- | --- |
| Phone number formatting (any common format) | Regex transforms — **formatPhone** |
| Name order (Last, First → First Last) | Regex transforms — **flipNameComma** |
| Case standardization | Regex transforms — **toUpperCase** / **toLowerCase** |
| Trimming leading or trailing whitespace | Regex transforms — **trim** |
| Removing or replacing specific characters | Liquid |
| Conditional output or fallback values | Liquid |
| Complex multi-step logic not covered by built-in keywords | Liquid |

## Related articles

- [Display signature elements based on field value (Liquid templates)](https://help.opensense.com/docs/display-signature-elements-based-on-field-value-liquid-templates-only)
