aer exec
Execute anonymous Apex code
Synopsis
Execute anonymous Apex code.
The Apex code can be provided as a positional argument or piped via stdin. Use the –path flag to specify source directories containing additional Apex classes.
aer exec [apex-code] [flags]Options
--allow-callouts allow outbound HTTP callouts to endpoints permitted by Remote Site Settings or Named Credentials
--allow-email deliver Messaging.sendEmail output via SMTP (configured by AER_SMTP_HOST/PORT/USER/PASSWORD, default localhost:25); without this flag email is logged and discarded
--api-version float Apex API version to apply to the anonymous block (set lower, e.g. 21.0, to access objects removed after that release like FeedPost) (default 66.0)
--bootstrap-db string bootstrap SQLite database to seed before execution
--certificate strings load a PEM-encoded certificate key file; the certificate name is derived from the filename (extension stripped; repeatable)
--certificate-dir strings load every PEM file (.pem/.crt/.cer/.key) in a directory as certificate keys named after their filenames (repeatable)
--certificate-key strings associate a certificate developer name with an inline base64-encoded PEM key (format: CertName=BASE64; e.g. the output of 'openssl base64 -A'; repeatable)
--currency string org default currency ISO code (e.g., USD, EUR, GBP)
--db string database to use: a SQLite file path, a postgres:// DSN, or postgresqltest:// for an ephemeral PostgreSQL server (default: in-memory SQLite)
--debug Enable debug mode with DAP server
-d, --default-namespace string treat loaded code as if it belongs to the specified namespace
--enforce-governor-limits enforce governor limit checks during anonymous execution
--feature strings enable optional features (PersonAccounts, HealthCloud, LiveAgent, OmniChannel, MultiCurrency, FinancialServicesCloud, B2BCommerce, RevenueCloud, LifeSciencesCloud, ConsumerGoodsCloud, ManufacturingCloud, Scheduler, CRMAnalytics, PrivacyCenter, ExperienceCloud, FieldService, Knowledge, EducationCloud, HighVelocitySales, WorkplaceCommandCenter, StateAndCountryPicklist, Division)
-h, --help help for exec
--locale string default locale for users (e.g., en_US, en_GB, de_DE)
--package strings package files to load (can be specified multiple times)
--package-dir strings directories containing .pkg files to load (can be specified multiple times)
-p, --path strings source paths containing Apex classes (can be specified multiple times)
--profile file[="-"] write Apex profiling data to file (use --profile without a file to open in Perfetto)
--sandbox set Organization.IsSandbox to true
--timezone string default timezone for users (e.g., America/Los_Angeles, America/Chicago)
--trace file[="-"] write Apex execution trace to file (use --trace without a file to open in Perfetto)Options inherited from parent commands
--help-aerrc show how the .aerrc configuration file works and exit
-q, --quiet suppress progress output
-v, --verbose count increase verbosity (repeat for more detail)SEE ALSO
- aer - aer is the Apex Execution Runtime