How to Use the Code Agent in GetGenerative.ai: A Step-by-Step Guide
The Code Agent is a built-in component of the Build Agent, designed to accelerate Salesforce development with intelligent code generation, editing, testing, and deployment. It automatically activates when customization tasks are identified in your implementation workbook, such as Apex classes, triggers, Lightning Web Components (LWCs), test classes, Visualforce, and Aura components.
With deep integration into your user stories, solution workbooks, and org metadata, the Code Agent offers an AI-powered development environment that aligns with your best practices and existing codebase.
1. Getting Started with Code Agent
You don’t need to activate the Code Agent manually. It becomes visible as soon as the Build Agent detects customization elements in your Implementation Workbook. Navigate to the Codebase View within the Build Agent tab to begin.
To enable full functionality, connect your Salesforce org:
- Go to Manage Connections
- Enter your Salesforce URL, username, password, and security token
- Once authenticated, the system allows:
- Real-time code deployment to sandboxes
- Codebase extraction from your org for editing or syncing
2. Reviewing Customization Tasks
From the Implementation Workbook, the Code Agent pulls in user stories that require custom development.
For each:
- The system categorizes the configuration (code vs point-and-click)
- Generates a task entry with:
- File type (e.g., Apex Trigger, LWC)
- Task name and description
- Linked user story and workbook reference
- Developer notes and status
These tasks serve as the foundation for generating your code files.
3. Best Practice Configuration
Before coding begins, the platform prompts you to review or configure organizational best practices for code development.
These include:
- Naming conventions for files, variables, classes
- Structural patterns for Apex, LWCs, Aura, and VF
- Security rules and documentation standards
These settings are respected throughout the code generation process, ensuring consistency with your enterprise guidelines.
4. Launching the Code Editor
Click Open Editor to enter the full AI-powered development workspace. You can also access the editor directly from individual files listed in the Codebase View.
Inside the editor:
- All customization files are visible on the left
- Click on any file to view or modify it
- The AI prompt is auto-filled with:
- Linked user story and acceptance criteria
- Developer notes from the workbook
- Contextual technical details
Click Generate Code to begin.
5. Generating and Applying Code
Once you initiate code generation:
- The Dev Assistant analyzes all contextual inputs
- Selects the most relevant proprietary LLM (GPT-4o, Claude 3.5/3.7, Gemini 2.5 Pro)
- Writes production-ready code—aligned with best practices
When the code is ready:
- Click Apply Code to insert it into the file
- Use Apply All for multi-file operations
- If a file already exists, the system:
- Shows a diff view (old vs. new)
- Lets you approve or reject changes
You can continue interacting with the assistant via chat to:
- Add validations
- Optimize logic
- Refactor code
- Explain specific sections
6. Working with Test Classes
The Code Agent makes test class management seamless.
When working on an Apex class or trigger:
- Click Actions → Create New Test Class
- Enter a name and click Create
The system:
- Auto-links the test class to its parent Apex file
- Sends a prompt to the Dev Assistant to generate a test class based on the logic
- Analyzes the Apex class to determine test methods, mocking, and coverage goals
Once generated:
- Click Apply Code to save it into your codebase
- Compile and deploy the test class to your sandbox
- Click Run Test to execute it immediately
You can also view real-time test coverage reports:
- See which lines and classes are covered
- Drill into specific files from the report
- Modify test classes using chat commands (e.g., “add more assertions,” “increase branch coverage”)
7. Compile and Deploy
After code generation:
- Click Compile to validate syntax and readiness
- Errors are highlighted inline for quick resolution
- Once ready, click Deploy to Org to push code to:
- Developer Sandboxes
- Scratch Orgs
- Dev/Test environments
You can also deploy multiple files at once using bulk apply and deploy actions.
8. Syncing, Refreshing, and Saving Files
Stay aligned with your Salesforce org:
- Refresh from Org to pull latest metadata and code files
- Compare and merge with your in-progress edits
- Save Locally to back up your code or transfer it externally
These actions ensure you’re never out of sync with other devs or environments.
9. Advanced AI Interactions
The Code Agent is more than a static generator—it’s a live coding assistant.
You can:
- Ask open-ended queries like “Explain this method” or “Refactor this loop”
- Target specific files without naming them—the system understands context
- Use follow-up commands to improve, simplify, or document code
Example Prompts:
- “Add field-level security check to this trigger”
- “Optimize this SOQL query”
- “Explain the logic behind this LWC controller”
10. Developer Workspace Features
- Multi-tab editing – Open several files simultaneously
- Dark mode toggle – Developer-friendly UI customization
- Chat history clearing – Reset AI interactions as needed
- Expand/collapse all sections – For easier navigation
The entire interface is built to feel like a natural extension of a Salesforce developer’s IDE, but with AI intelligence woven in.
Summary
The Code Agent transforms Salesforce development into a streamlined, intelligent workflow:
Feature |
Description |
Auto-activated |
Kicks in when custom tasks are detected in Build Agent |
Org Connection |
Enables deployment, metadata sync, test execution |
Context-Aware Coding |
Based on user stories, config workbooks, and dev notes |
Proprietary LLM Support |
GPT-4o, Claude 3.5/3.7, Gemini 2.5 Pro |
Full Dev Editor |
Multi-file support, real-time generation, syntax validation |
AI Chat Support |
Refactor, debug, document code with natural language |
Test Class Integration |
Auto-generate, compile, run, and view coverage |
Continuous Sync |
Refresh from org or save locally for version control |
FAQs
1. Can it modify existing files?
Yes. The Code Agent analyzes your current Salesforce org files and suggests either patch updates or full rewrites. It highlights all modified lines for easy review before applying any changes.
2. What types of files are supported?
It supports a full range of Salesforce development files, including:
- Apex Classes
- Apex Triggers
- Lightning Web Components (JS, HTML, XML)
- Aura Components
- Visualforce Pages
- Related metadata files
3. Which LLMs are available for code generation?
You can choose from multiple best-in-class models, including:
- GPT-4o
- Claude Sonnet 3.5 and 3.7
- Gemini 2.5 Pro
Model selection can be customized per file or project.
4. Can it generate test classes and track coverage?
Yes. The Code Agent can:
- Auto-generate complete test classes
- Compile and deploy them
- Execute tests directly in your sandbox
- Display real-time test coverage
You can also use the Dev Assistant to improve coverage or add more test scenarios via natural language prompts.
5. What else can the Dev Assistant do?
The Dev Assistant supports a wide range of developer tasks:
- Contextual file modifications
- Intelligent code explanations
- Validation and compilation
- Deployment to Salesforce orgs
- File syncing and multi-step bundle updates
All with support for conversational inputs and context awareness.