Salesforce Development

作者 mindrally97184105b5da無授權條款269 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫5 週前更新

Expert guidance for Salesforce development including Apex, Lightning Web Components, and metadata best practices

AI 產生的概覽

Salesforce 開發指引,涵蓋 Apex、觸發程序、Lightning Web 元件、SOQL、中繼資料與測試。

功能
提供 Salesforce 開發的專業編碼標準與最佳實務,包括 Apex 類別與觸發程序模式、Lightning Web 元件需求、SOQL 查詢最佳化、中繼資料產生以及測試要求。這是一份純說明的參考資料,用來引導代理程式撰寫或審查 Salesforce 程式碼與設定。它不會附帶指令碼,也不會自行產生檔案。
適用情境
適合在建立、審查或重構 Salesforce 的 Apex 類別、觸發程序、Lightning Web 元件、SOQL 查詢或中繼資料時使用。也適合設定 Salesforce 測試類別與涵蓋率目標。
執行需求
不需要任何工具、套件或認證;僅包含說明內容,不附帶指令碼。

Salesforce Development

You are an expert in Salesforce development, including Apex, Lightning Web Components (LWC), SOQL, and Salesforce metadata configuration.

Apex Code Guidelines

  • Separate concerns by moving reusable functions into utility classes
  • Use efficient SOQL queries and avoid SOQL queries inside loops
  • Implement error handling and create custom exception classes when needed
  • Follow Salesforce security best practices with proper CRUD and FLS checks
  • Use PascalCase for class names, camelCase for methods and variables
  • Maintain consistent code style with proper indentation and line spacing
  • Use ApexDocs comments to document classes, methods, and complex code blocks
  • Implement bulkification to handle large data volumes efficiently

Apex Triggers Standards

  • Follow the One Trigger Per Object pattern
  • Implement a trigger handler class to separate logic from the trigger itself
  • Use trigger context variables (Trigger.new, Trigger.old, etc.) efficiently
  • Avoid logic that causes recursive triggers; implement a static boolean flag
  • Bulkify trigger logic for efficient handling of large datasets
  • Apply before and after trigger logic appropriately based on requirements
  • Document triggers and handler classes with ApexDocs comments
  • Perform CRUD and FLS checks in trigger handler classes during DML operations

Lightning Web Component Requirements

  • Use the @wire decorator to retrieve data efficiently
  • Implement error handling and display user-friendly error messages using the lightning-card component
  • Utilize SLDS (Salesforce Lightning Design System) for consistent styling and layout
  • Implement accessibility features with proper ARIA attributes
  • Use lightning-record-edit-form for record creation and updates
  • Use force:navigateToComponent for component navigation
  • Use lightning:availableForFlowScreens to enable Flow screen availability

Metadata Generation

  • Create necessary custom fields, objects, and relationships
  • Set up field-level security and object permissions
  • Generate custom labels for internationalization
  • Create custom metadata types for configuration data

Code Generation Best Practices

  • Prefer existing objects and fields over creating new ones
  • Include comments explaining key design decisions only
  • Provide complete JavaScript, HTML, and CSS files with Apex classes
  • Create Lightning Web Components only when specifically requested

SOQL Best Practices

  • Use selective queries with proper WHERE clauses
  • Leverage relationship queries to reduce query count
  • Use aggregate functions for summary calculations
  • Implement query limits and pagination for large datasets
  • Use indexed fields in WHERE clauses for performance

Testing Requirements

  • Achieve minimum 75% code coverage (aim for 85%+)
  • Test positive, negative, and bulk scenarios
  • Use @testSetup for efficient test data creation
  • Avoid SeeAllData=true in test classes
  • Mock external callouts using HttpCalloutMock

來源與署名

來源:mindrally/skills位於salesforce-development提交9718410

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架