Advanced 25 min read

Design the Case Model

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

  • Design the fields Case routing needs beyond the standard Case object
  • Decide where the routing rules themselves should live
  • Apply Module 29's decision process to choose custom metadata for the rules

Prerequisites: Module 29: "Custom Settings and Custom Metadata"

What we're building

"When a new Case is created, automatically assign it to the correct
support queue based on its Priority and Type — and let support
managers adjust the routing rules without needing a code deployment
for every change."

Every module from 24 through 29 gets used here: a trigger (24) that's bulk-safe (25), respects field-level security (28), and reads its routing rules from custom metadata (29) instead of hardcoded values.

Fields beyond the standard Case object

Case (standard object, extended)
  - Priority (standard field: Low, Medium, High)
  - Type (standard field: Question, Problem, Feature Request)
  - Assigned_Queue__c (new custom field: Text)

Priority and Type already exist on the standard Case object — this feature reads them, it doesn't need to add them. The only new field needed is Assigned_Queue__c, which the trigger will populate automatically.

Choosing custom metadata for the rules

Applying Module 29's decision process directly: "does this need to deploy alongside code and stay in sync across sandbox/production?" Yes — routing rules should be testable and deployable together with the trigger logic that reads them, and a support manager adjusting a rule shouldn't require re-deploying Apex. This points clearly at custom metadata, not a custom setting or a hardcoded value.

Case_Routing_Rule__mdt
  - Priority__c (Text)
  - Case_Type__c (Text)
  - Queue_Name__c (Text)

Exercise

As a comment, apply Module 29's decision process to explain why Case_Routing_Rule__mdt should be custom metadata rather than a hierarchy custom setting.

Show hint

Think about the deployability question specifically.

APEX

Design the Case Model Quiz

1. Why store the routing rules as custom metadata instead of hardcoding them directly in the trigger handler?

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

This module builds automatic Case routing: when a new Case is created, its Priority and Type determine which support queue it's assigned to — with the routing rules themselves stored as custom metadata, not hardcoded.