---
title: Server-Side Folder Automation via API
type: article
created: '2026-04-05'
updated: '2026-04-05'
source_docs:
- raw/2025-10-09-quarra-salesforce-call-93107201.md
tags:
- automation
- salesforce
- api
- folder-management
- crm
- it-coordination
layer: 2
client_source: null
industry_context: null
transferable: true
---

# Server-Side Folder Automation via API

## Overview

When a CRM record reaches a meaningful stage — lead creation, qualification, or conversion — it can trigger automated creation of a corresponding project folder on a network server. This pattern keeps file storage in sync with CRM activity without manual intervention, but it requires careful coordination between the CRM implementation team and the client's IT/infrastructure provider.

The core challenge is that the CRM (e.g., Salesforce) lives in the cloud while the target folder structure typically lives on a managed on-premises or hosted server that is locked down by an IT provider. Bridging these two environments requires API access negotiated with that provider.

## Implementation Pattern

### Trigger Point

Folder creation can be triggered at different CRM stages depending on business need:

- **On lead creation** — useful when teams need a place to store early-stage research, RFPs, or correspondence before a deal is qualified. This is the preferred approach for project-centric businesses (e.g., stone fabrication, construction) where work begins at the prospecting stage.
- **On opportunity conversion** — a common default, but may be too late if teams are already accumulating files during the lead stage.

> **Quarra Stone example:** Lincoln Durham confirmed that folder creation should happen at the **lead stage**, not the opportunity stage, because sales reps need somewhere to put materials as soon as a project is being pursued. See [[clients/quarra-stone/_index]].

### Technical Approach

The recommended implementation uses a server-side trigger fired from Salesforce:

1. A **Salesforce Flow or Apex trigger** fires when the target record is created or reaches the designated stage.
2. The trigger calls an **external API endpoint** (e.g., a lightweight Node.js service) that has authenticated access to the file server.
3. The API service creates the folder using the prospect number, project name, or other CRM-derived naming convention.
4. Optionally, the resulting folder path is written back to the CRM record for easy navigation.

```
Salesforce Record Event
        ↓
  Flow / Apex Trigger
        ↓
  HTTP callout → Node.js (or similar) middleware
        ↓
  Server API / file system access
        ↓
  Folder created at [server path]/[prospect-number]-[project-name]/
```

### Naming Convention

Folder names should be derived from stable CRM fields to ensure consistency and avoid collisions:

- **Prospect number** — auto-generated, unique, persistent across lead-to-opportunity conversion (see [[knowledge/crm-automation/prospect-number-automation]])
- **Project name** — human-readable identifier used by the client and their partners (GC, architect, etc.)

A combined format such as `QS-00123 — Tang Wing Met` provides both machine-sortability and human readability.

## IT Coordination Requirements

This integration cannot be completed by the CRM team alone. The following stakeholders must be involved:

| Role | Responsibility |
|---|---|
| CRM implementer | Build the Salesforce trigger and callout logic |
| Technical developer | Build and host the middleware API service |
| Client IT provider | Grant server access, define API or protocol, configure firewall/auth |
| Client stakeholder | Facilitate introduction and confirm requirements |

### What to Get from the IT Provider

Before the development call, confirm:

- **Access method** — Does the server expose an existing API, SMB share, SFTP, or something else?
- **Authentication** — API key, OAuth, service account credentials?
- **Firewall/network restrictions** — Can the middleware service reach the server from a cloud host?
- **Folder structure** — What is the expected parent path? Are there naming rules or character restrictions?
- **Permissions** — What access level does the created folder need?

> **Note:** IT providers managing locked-down servers (e.g., Vieth IT for Quarra Stone) may need advance notice to open the necessary access. Plan for at least one coordination call before development begins, and ensure a **technically capable representative** attends — not just an account manager.

## Common Pitfalls

- **Wrong IT contact on the call** — Account managers cannot answer questions about API access or firewall rules. Request a sysadmin or network engineer.
- **Triggering at the wrong stage** — Defaulting to opportunity conversion may leave a gap where files have nowhere to go during the lead stage.
- **Numbering collisions** — If backfilling prospect numbers on existing records, the folder-creation script must check for pre-existing numbers before assigning new ones to avoid duplicate folder names.
- **No write-back to CRM** — Without storing the folder path on the record, users must navigate the server manually. A simple URL or UNC path field on the lead/opportunity record closes this gap.

## Related Articles

- [[knowledge/crm-automation/prospect-number-automation]]
- [[knowledge/crm-automation/lead-stage-design]]
- [[knowledge/crm-automation/bant-scoring-leads]]
- [[clients/quarra-stone/_index]]