DA10: Capstone: three automations for Sharma Textiles

Lesson 4 of 5 · reading 15–25 minutes; practice and project time is on the module page

Project 3: the weekly CRM tidy-up

🎯You'll be able to

Build the CRM tidy-up with a dry run, backup, change limit and approval, and prove it with the acceptance tests.

🏠The everyday picture

Every Sunday, a shopkeeper sorts the stockroom: duplicate boxes combined, wrong labels fixed, empty boxes thrown out. Then they note what changed, so nothing surprising happens on Monday.

📘What it really is

📝A worked example

A learner's first live run, after two dry runs:

Measure Value
Contacts before 412
Phones cleaned 63
Duplicates merged 41 (report lists each pair)
Sent to review 9 invalid phones, 4 missing owner
Contacts after 371
Change share 137 of 412 contacts touched (about 33%): above the 10% limit, so it paused for approval

The owner reviewed the report and approved. Because this was the first clean-up, the large change was expected; the following week only 6 contacts changed.

🌍Where it's used

📝Case scenario

A tidy-up script without a dry run or change limit merges 200 contacts wrongly after a CRM field was renamed, so every email field looked empty. The learner restores from the backup, adds a check that stops the run if a key field is empty for most contacts, adds the dry run and the 10% limit, and runs two dry runs before going live again.

🖱️Try it

Build the tidy-up with dry-run mode, a backup export, a change report and a change limit. Run it twice in dry-run mode on your sample CRM, compare the reports with a manual check of 20 contacts, then run it live.

⚠️Common mistakes

🛠️For your project

This is Project 3. Run node tests/tidyup.js; it runs a dry run, a live run with approval, and a second live run that should change nothing.

✅Quick check

What is a dry run?

Show the answer

A run that produces the full report of what would change, without changing anything.

Why set a limit on how many contacts one run can change?

Show the answer

So an unexpected large change, often caused by a bug or a changed field, waits for a person to check it.

← PreviousProject 2: the inbox router
ProLearners Assist