Intermediate 25 min read

Design the Requirement

By the end of this lesson, you'll be able to:

  • Translate a plain-language business request into a precise technical requirement
  • Identify which object and trigger event the requirement points to
  • Recognize ambiguity in a requirement before writing any code

Prerequisites: Module 25: "Governor Limits and Bulk-Safe Code"

What we're building

Over this module you'll build a real CRM automation, end to end:

"Whenever an Opportunity is marked Closed Won, automatically add its Amount to a Total_Won_Revenue__c field on the related Account, so sales managers can see each account's total closed business without running a report."

This is a genuinely common real-world Salesforce request — and this module builds it the right way: designed, bulkified, validated, and tested, using everything from Modules 22-25.

Turning the request into a precise requirement

The plain request above is a good starting point, but it has gaps a developer has to fill in before writing code:

  • Which object, which event? Opportunity, on after update (the Amount only needs rolling up once the Opportunity is actually saved as Closed Won — Module 24's before/after distinction matters here).
  • What if the Opportunity's Stage changes away from Closed Won later? The requirement as stated doesn't say — a real requirement needs this answered explicitly (this module's decision: subtract it back out).
  • What if Amount is blank? Treat it as 0, so the rollup never breaks on missing data.

Why spotting ambiguity matters before coding

Writing code against an ambiguous requirement means guessing — and a guess that's wrong isn't discovered until a stakeholder sees the finished feature behave unexpectedly. Explicitly naming and resolving each gap now (as this lesson just did) means the rest of this module's lessons build on a requirement everyone would actually agree with, not an assumption.

Exercise

As a comment, identify one more piece of ambiguity in the original request beyond the three already resolved, and propose a reasonable answer.

Show hint

Think about edge cases like a deleted Opportunity, or an Opportunity moving between Accounts.

APEX

Design the Requirement Quiz

1. Why resolve ambiguity in a requirement before writing any code?

Log in to submit the quiz and save your score.

My Notes

Log in to keep private notes on this lesson.

Questions about this lesson

No questions yet — be the first to ask.

Log in to ask a question about this lesson.

Summary

Before writing a single line of trigger code, this lesson turns a plain sales-team request into a precise, unambiguous technical requirement.