Enterprise Guide - Codex and Claude in Salesforce

Admin, Development, and Automation

Admin work, Apex, LWC, and Flow/automation guidance for implementation teams.

18 min readUpdated March 11, 2026By Shivam Gupta
6Linked documentation pages
27Core guide sections
Mixed audienceArchitecture to leadership
OperationalPrompts, governance, roadmaps

Section 7: Use in Salesforce Admin Work

7.1 High-value admin use cases

  • field creation planning
  • validation rule drafting
  • formula generation
  • Flow design and naming
  • Flow debugging
  • page layout and Dynamic Forms recommendations
  • report/dashboard definitions
  • permission set design support
  • email template drafting
  • assignment and escalation rule logic
  • knowledge setup
  • case configuration
  • sandbox setup checklists
  • release note summarization

7.2 Examples

#### Validation rule

Create a Salesforce validation rule for Opportunity that prevents stage moving to Closed Won when Primary_Contact__c is blank and Implementation_Date__c is in the past. Explain the logic in plain English and include test scenarios.

#### Formula support

Create a Salesforce formula field that classifies a case as SLA Breached if Status is not Closed and NOW() is greater than Milestone_Target__c. Also provide null handling guidance.

#### Flow debugging

Review this screen flow outcome summary and explain likely failure points:
- user sees generic fault message after submit
- records created sometimes duplicate
- one path skips approval task creation

Recommend debug steps, logging strategy, and design fixes.

7.3 Admin best practices

  • Always ask AI for both formula/Flow logic and plain-English explanation.
  • Request test scenarios with every admin artifact.
  • Ask for naming conventions, descriptions, and maintenance notes.
  • Review performance impact before implementing complex Flow loops.

7.4 Do and don't

DoDon't
use AI to draft formulas and explain thempaste confidential customer records
use AI for sandbox/release checkliststrust generated Flow logic without testing
use AI to improve field descriptions and documentationallow AI to define security access without review

Section 8: Use in Apex Development

8.1 Where AI is most valuable

AI is highly effective in Apex when used for:

  • class scaffolding
  • trigger/handler structure
  • service layer and selector patterns
  • queueables, batches, schedulables
  • invocable methods
  • REST resources
  • callout code
  • platform event subscribers
  • wrapper classes
  • test data setup and test classes
  • refactoring and readability improvements
  • code review and defect isolation

8.2 Target patterns

  • trigger framework
  • domain/service separation
  • selector pattern for SOQL centralization
  • utility classes
  • custom metadata-driven logic
  • error normalization
  • retry strategies

8.3 Example scenarios

#### Contact lookup by email/phone

Use AI to generate:

  • normalized search utility
  • bulk-safe lookup service
  • test coverage for duplicate hits and no-hit scenarios

Prompt

Create Apex using a service layer and selector pattern to find contacts by normalized email or phone.
Requirements:
- bulk-safe
- with sharing
- null-safe
- return wrapper with match confidence and source field
- include tests
- avoid SOQL in loops

#### Loan eligibility service

Use AI to:

  • create a service class that evaluates applicant data
  • externalize thresholds into custom metadata
  • design a response wrapper for UI and integration reuse

#### External API callout

Use AI to:

  • create named credential-based callout service
  • add timeout handling and response parsing
  • generate HttpCalloutMock tests

#### Batch data cleanup

Use AI to:

  • generate a batch class to normalize duplicate data or archive stale records
  • design retry/resume pattern where appropriate

#### Case assignment engine

Use AI to:

  • compare Flow, custom metadata, and Apex routing options
  • implement a metadata-driven assignment service

#### Reusable utility framework

Use AI to:

  • refactor repeated date formatting, error handling, or mapping logic into a utility layer

8.4 Apex review checklist

  • Is the code bulkified?
  • Is sharing behavior correct?
  • Are limits considered?
  • Are SOQL/DML in loops avoided?
  • Are nulls handled explicitly?
  • Are callouts mocked in tests?
  • Is error handling user-safe and support-friendly?
  • Is custom metadata used where hard-coded business rules should not exist?

8.5 Human review required

Never deploy AI-generated Apex without:

  • peer review
  • static analysis
  • governor limit review
  • positive and negative test execution
  • security review if handling sensitive data

8.6 Anti-patterns

  • gigantic all-in-one triggers
  • hidden side effects in helper methods
  • hard-coded IDs and endpoints
  • tests that only assert non-null
  • logic that ignores mixed bulk operations

Section 9: Use in LWC Development

9.1 LWC use cases

  • component scaffolding
  • HTML/JS/CSS generation
  • wire adapter usage
  • imperative Apex calls
  • event communication
  • reusable components
  • datatable patterns
  • wizard flows
  • modals
  • file upload
  • responsive layouts
  • accessibility improvements
  • Jest tests
  • debugging rendering issues

9.2 Example use cases

#### Intake form

AI can draft:

  • form sections
  • client-side validation
  • Apex submission contract
  • UX copy

#### Contact creation wizard

AI can generate:

  • multi-step navigation
  • validation summary banner
  • save/resume behavior
  • toast/error handling

#### Dashboard widgets

AI can produce:

  • KPI cards
  • chart data transformation
  • refresh logic
  • empty state UX

#### Document upload screen

AI can support:

  • file validation
  • progress display
  • upload error messaging

#### Custom portal component

AI can help with:

  • Experience Cloud constraints
  • external user-friendly messaging
  • responsive design for smaller form factors

9.3 LWC prompt example

Create a Lightning Web Component for a 3-step customer intake wizard.
Requirements:
- mobile responsive
- accessible labels and keyboard navigation
- validate email, phone, and required documents
- use imperative Apex save on final step
- show inline errors and a summary banner
- include Jest tests outline

9.4 Best practices

  • Ask for accessibility considerations every time.
  • Ask for performance considerations when using datatables or repeated renders.
  • Request both component code and explanation of state transitions.
  • Validate security, field access, and data exposure assumptions.

Section 10: Use in Flow and Automation

  • decision logic drafting
  • naming convention enforcement
  • screen copy/help text
  • auto-launched flow planning
  • subflow decomposition
  • error path design
  • failed flow troubleshooting
  • Flow documentation
  • process-to-Flow conversion
  • Flow versus Apex decisions

10.2 Prompt example

Design a record-triggered flow for Case that:
- runs on create and update
- routes high-priority cases to an escalation queue
- creates a follow-up task when customer SLA risk is high
- avoids recursion
- includes fault paths
- uses maintainable naming conventions

Provide the recommended elements, decisions, entry criteria, and documentation notes.

10.3 Flow governance guidance

  • prefer before-save for simple field updates
  • use subflows for repeated business logic
  • avoid overly complex loops in large-volume transactions
  • document every fault path
  • define ownership for every major automation

10.4 Flow vs Apex decision table

ScenarioPrefer FlowPrefer Apex
simple record updateyesno
admin-maintained branchingyesmaybe
complex cross-object orchestrationmaybeyes
heavy-volume logicriskyoften yes
complex external calloutslimitedyes