---
title: Generate an outbound EDI file name
summary: Produce a timestamped, environment-tagged file name for an outbound EDI file.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-15
library: SAIF.Framework.Common.Files
reference_type: package
operation_id: OP-11
trigger: Caller request prior to writing an EDI file
---

# Generate an outbound EDI file name

`NameBuilder.GetFileName` produces a timestamped, environment-tagged file name intended to precede [Write an EDI interchange file](write-edi-interchange-file.md).

| Field | Value |
| --- | --- |
| **Operation ID** | OP-11 |
| **Trigger** | Caller request prior to writing an EDI file. |
| **Inputs** | `fileType`, `isProd`. |
| **Outputs** | `"{yyyyMMddHHmmss}_SAIF_{P\|T}_{fileType}.txt"` using `DateTime.Now`. |
| **Primary components** | `NameBuilder.GetFileName` |
| **Entry point** | `Common\SAIF.Common.Files\Edi\NameBuilder.cs` |

## Steps

1. Capture the current timestamp via `DateTime.Now` and format it as `yyyyMMddHHmmss`.
2. Select the environment flag: `P` when `isProd` is true, `T` otherwise.
3. Compose `"{timestamp}_SAIF_{flag}_{fileType}.txt"` ([BR-055](../business-rules.md#br-055-generated-edi-file-name-pattern)).

No delegation to `SAIF.Framework.Common` occurs, and no database access is involved.

## Process flow

```mermaid
flowchart TD
	Start(["Caller: GetFileName(fileType, isProd)"]) --> Ts["Capture DateTime.Now as yyyyMMddHHmmss"]
	Ts --> Flag{isProd?}
	Flag -->|Yes| P["Environment flag = P"]
	Flag -->|No| T["Environment flag = T"]
	P --> Compose["Compose<br>{timestamp}_SAIF_{flag}_{fileType}.txt"]
	T --> Compose
	Compose --> EndOk([File name string returned])
```

## Failure and edge-case behavior
- The file name uses `DateTime.Now` (local server time), so file names generated across a daylight-saving or time-zone boundary are not directly comparable to UTC timestamps recorded elsewhere.*

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts.

## Sources
- Common\SAIF.Common.Files\Edi\NameBuilder.cs
