A supplier, a logistics provider or a payroll provider drops a CSV file on an SFTP server every night. Someone downloads it, fixes a few columns in a spreadsheet and imports it into Salesforce by hand. Automating that looks like a 50-line script, and an AI chatbot will write the script in seconds.
The script works on day one. These are the seven things that break it in month two, and what to do about each.
1. Reading a file that is still being written
The sender's upload and your nightly run overlap, and you import half a file. Nothing fails; you just have half the records.
Fix: only take files that have not changed for a while (a minute is a sensible default), or agree that the sender uploads under a temporary name and renames when done. Do the same for your own uploads: write .orders.csv.part, then rename it to orders.csv once it is complete.
2. Reading the same file twice
The run fails after the import but before the cleanup, and the next night imports the same file again.
Fix: move the file to an archive folder before you read it, and read it from there. If the run fails, the file is still in the archive for a retry, and the next run will not pick it up again.
3. A new date in the file name every day
orders_2026-11-20.csv, orders_2026-11-21.csv … A fixed file name stops working on day two.
Fix: match a pattern such as orders_*.csv, or take only the newest match. Decide upfront what happens when two days arrive at once (after a holiday, for example).
4. Duplicates in Salesforce after a re-run
An insert-only import creates every record a second time when you re-run a night.
Fix: upsert on an external ID field (the supplier's order number, for example) instead of inserting. A re-run then updates the same records.
5. A renamed column or a new date format
The sender renames Cust No to Customer Number, or switches from 21.11.2026 to 2026-11-21. A script that reads columns by position writes wrong values. One that converts loosely writes empty fields.
Fix: map columns by name, give each one a type, and set aside rows that do not fit with a clear message instead of writing them half-empty.
6. Credentials and host keys
The password sits in the script, and the script accepts whatever server answers.
Fix: keep credentials out of code. Pin the server's host key, so a different server cannot answer in its place. If the server only accepts known addresses, connect from one fixed address that the server's operator can allow.
7. Failing silently
The job runs on a schedule nobody watches. A failed night is noticed when someone asks where last week's orders went.
Fix: log every run, with a result for every record, and alert on failure so a failed night is visible the next morning.
Where AI fits
An AI that writes the script saves the first hour and leaves you all seven problems. An AI that creates the pipeline in a tool that already handles them is more useful. Either way, check five things before it writes to Salesforce:
- Does it use your real object and field names, or plausible-sounding ones?
- Does a person approve every step that writes or sends data?
- Are records sent to the AI model? Field names are enough to build a pipeline.
- Where do the credentials live? Not in a script, and not in the chat.
- Can you run the steps before the write on their own and check their output?
Disclosure: this post is from the team behind Floverk, a data pipeline platform for Salesforce, CSV and other files, SFTP servers and REST APIs. In Floverk, the job above is a pipeline of four steps (SFTP Download → CSV Input → Map Fields → Data Writer) built on a visual canvas, or created by its AI Copilot, and every step that writes waits for a person's click. The longer guide, including REST APIs: Can an AI copilot create a data pipeline for Salesforce, CSV, SFTP and REST APIs?
Top comments (1)
Moving the file to archive before reading it is the move that stops the retry from re-importing the same rows.