Find or create a Descartes BoxTop job without duplicates
Keying a shipment into a TMS by hand is slow, and automating it creates a new risk: the second email about the same shipment makes a second job. BoxTop’s API documents no duplicate protection, so this recipe searches for the customer’s reference before it creates anything.
1. Build it on sample data
Section titled “1. Build it on sample data”Add a BoxTop connection and choose Sample data. It needs no key, answers from a fixed set of fictional records and sends nothing, so you can build and run the whole automation first. Every answer from it has sample set to true.
2. Read the shipment
Section titled “2. Read the shipment”Start from Email received or an Operation form, and read the documents into fields: at least the customer’s account number and reference. Put a person in the loop if a wrong job would be costly.
3. Get the job
Section titled “3. Get the job”Add Find or create BoxTop job with the Job prefix, Account number and Reference, and any other fields you have.
It looks for a job with that account and reference first. If there is none, it creates one and reads it back. Connect both the Created and Existing exits to the next block, so the run goes on either way.
An existing job is used as it is, and your new values are ignored. BoxTop’s help lists no general job update. If the values could differ, read the job with Find BoxTop job and compare them with Checklist before you carry on.
4. Add to the job
Section titled “4. Add to the job”- Add BoxTop shipping invoice adds a commercial invoice and its lines.
- Attach BoxTop documents uploads up to 32 files of up to 10 MB each, one request per file.
- Add BoxTop milestone records a milestone. Use Get BoxTop job milestones first to see which names your site uses.
What goes wrong
Section titled “What goes wrong”- A create times out. A rate limit, server error or timeout on the create says the job may have landed. So does a read-back that finds nothing. Check BoxTop before you run the step again.
- Running a step again can still duplicate. Find or create searches first, so it finds a job that landed. But if BoxTop can’t list the new job yet, it creates a second one.
- Attach runs again from the first file. A rerun of Attach BoxTop documents can add files twice. It stops at the first file it can’t attach, and the files already accepted stay on the job.
- A job with a blank reference never matches. Treat an empty reference as an error before this block.
- A wrong API address can look like Not found on a job number search in Find BoxTop job, so don’t take it as proof the job is absent.