Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Salesforce Developer
hard

How would you modernize a legacy Apex/VF org over 1-2 years?

"Modernise" usually means: get off old patterns, adopt DX, migrate VF to LWC, replace Workflow/Process Builder with Flow, tighten security, improve test coverage, set up CI/CD.

Phase 1: Assessment (weeks 1-4)

  • Inventory: every Apex class, trigger, flow, VF page, Workflow, Process Builder. Categorise by criticality and complexity.
  • Code quality scan: PMD, Apex Static Analysis. Identify governor-limit risk, security issues, deprecated patterns.
  • Test coverage audit: where's coverage thin? Which classes have 75% coverage but no real assertions?
  • DX-readiness: convert org metadata to source format. Set up Git repo as a baseline.
  • Stakeholder alignment: leadership buy-in, scope, timeline, success metrics.

Phase 2: Foundation (weeks 5-12)

  • Set up CI/CD: PR validation against scratch orgs. PMD checks. Jest for LWC. This protects future work.
  • Refactor critical classes: triggers without handlers, classes >1000 lines, anything with SOQL-in-loops.
  • Improve test coverage to 80%+ with meaningful assertions on critical paths.
  • Standards documentation: code style, branch policy, handler framework, naming conventions.
  • Security baseline: Health Check, Field-Level Security audit, Permission Set audit.

Phase 3: Process Builder / Workflow Migration (months 3-9)

  • Use Migrate to Flow tool for simple cases.
  • Manual rewrite for complex.
  • Test side-by-side in sandbox before flipping.
  • Phase by object: simple ones first.

Phase 4: VF -> LWC migration (months 4-18)

  • Inventory VF pages, prioritise by user impact.
  • Start with high-traffic, low-complexity pages.
  • Build component library — reusable LWC primitives that match the new design system.
  • Coexist: Aura/VF and LWC live in the same app during transition.

Phase 5: Security hardening (ongoing)

  • Move to Permission Set Groups; minimise Profile permissions.
  • Enforce MFA / SSO.
  • Tighten Sharing rules.
  • Enable Lightning Web Security where possible.

Phase 6: Performance and scale (ongoing)

  • Identify hot paths via Event Monitoring / debug logs.
  • Convert Roll-Up Summaries on large objects to scheduled calculations where appropriate.
  • Index audit (Setup -> Custom Indexes if available).
  • Bulkify all long-running flows / triggers.

Phase 7: Tooling and DX (months 1-6)

  • Migrate from Change Sets to Salesforce DX.
  • VS Code as the standard editor.
  • Set up scratch org-based feature branches.
  • Document the new workflow.

Phase 8: Governance (ongoing)

  • Code review process.
  • Release calendar.
  • Architectural decision records.
  • Onboarding documentation for new devs.

Common challenges:

  • Time pressure for new features. Modernisation can't pause feature work; carve out 20-30% capacity for tech debt continuously.
  • "It's not broken, why fix it?" sentiment. Show concrete metrics: deploy time reduced, error rate dropped, developer onboarding faster.
  • Knowledge gaps. Senior devs may not know LWC; pair / training as part of the plan.
  • Org politics — different teams own different parts of the org; coordinate carefully.

Success metrics:

  • Deploy time: hours -> minutes.
  • PR merge cycle time: days -> hours.
  • Apex test coverage: 75% -> 90%.
  • Production error rate.
  • Time to onboard a new dev: weeks -> days.

A 1-2 year modernisation is a major undertaking. Without leadership buy-in and continuous capacity, it stalls. With it, the gains compound — every month, code is faster to deploy, easier to change, safer to break.

Why this answer works

Architect-level. The phased plan, success metrics, and "carve out capacity continuously" insight are senior signals.

Follow-ups to expect

Related dictionary terms