salesforce_write_apex
Create or update Apex classes in Salesforce. Specify operation, class name, and code body to deploy Apex logic.
Instructions
Create or update Apex classes in Salesforce.
Examples:
Create a new Apex class: { "operation": "create", "className": "AccountService", "apiVersion": "58.0", "body": "public class AccountService { public static void updateAccounts() { /* implementation */ } }" }
Update an existing Apex class: { "operation": "update", "className": "AccountService", "body": "public class AccountService { public static void updateAccounts() { /* updated implementation */ } }" }
Notes:
The operation must be either 'create' or 'update'
For 'create' operations, className and body are required
For 'update' operations, className and body are required
apiVersion is optional for 'create' (defaults to the latest version)
The body must be valid Apex code
The className in the body must match the className parameter
Status information is returned after successful operations
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | Full body of the Apex class | |
| className | Yes | Name of the Apex class to create or update | |
| operation | Yes | Whether to create a new class or update an existing one | |
| apiVersion | No | API version for the Apex class (e.g., '58.0') |