wiki/knowledge/crm-automation/folder-automation-via-api.md · 741 words · 2026-04-05
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 [1].
Technical Approach
The recommended implementation uses a server-side trigger fired from Salesforce:
- A Salesforce Flow or Apex trigger fires when the target record is created or reaches the designated stage.
- The trigger calls an external API endpoint (e.g., a lightweight Node.js service) that has authenticated access to the file server.
- The API service creates the folder using the prospect number, project name, or other CRM-derived naming convention.
- 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 [2])
- 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