UNPKG

sf-agent-framework

Version:

AI Agent Orchestration Framework for Salesforce Development - Two-phase architecture with 70% context reduction

296 lines (243 loc) 8.93 kB
# Salesforce Best Practices Checklist ## Overview This checklist ensures Salesforce implementations follow platform best practices for maintainability, scalability, and performance. ## Development Best Practices ### Apex Development - [ ] Follow naming conventions (PascalCase for classes, camelCase for methods) - [ ] Implement proper error handling and logging - [ ] Use @future, Queueable, or Batch for async processing - [ ] Bulkify all code (handle collections, not single records) - [ ] Avoid SOQL/DML in loops - [ ] Check CRUD/FLS permissions before database operations - [ ] Write test classes with >90% coverage - [ ] Use Test.startTest() and Test.stopTest() properly - [ ] Mock external callouts in tests - [ ] Comment complex business logic ### Lightning Development - [ ] Use Lightning Web Components over Aura when possible - [ ] Implement proper component communication patterns - [ ] Cache data using Lightning Data Service - [ ] Handle errors gracefully with try-catch - [ ] Use @wire for data retrieval when possible - [ ] Implement loading states for better UX - [ ] Follow SLDS (Salesforce Lightning Design System) - [ ] Make components configurable via design attributes - [ ] Test on different form factors (desktop, tablet, mobile) - [ ] Ensure accessibility compliance ### Flow Best Practices - [ ] Use record-triggered flows over workflow rules - [ ] Implement one flow per object when possible - [ ] Use subflows for reusability - [ ] Add fault paths for error handling - [ ] Avoid loops when possible (use collection variables) - [ ] Test with bulk data - [ ] Document flow logic with descriptions - [ ] Use meaningful API names - [ ] Implement proper decision logic - [ ] Consider performance impact ## Data Model Best Practices ### Object Design - [ ] Use standard objects when they meet requirements - [ ] Follow naming conventions (API names, labels) - [ ] Create meaningful object relationships - [ ] Use appropriate field types - [ ] Set field-level help text - [ ] Define validation rules thoughtfully - [ ] Use record types for different business processes - [ ] Implement proper page layouts - [ ] Consider data volume growth - [ ] Plan for archival strategy ### Field Design - [ ] Use picklists over text fields for controlled values - [ ] Implement dependent picklists where appropriate - [ ] Use global value sets for reusability - [ ] Set appropriate field lengths - [ ] Mark required fields at database level - [ ] Use formula fields for calculated values - [ ] Implement roll-up summary fields correctly - [ ] Add field descriptions - [ ] Consider field history tracking needs - [ ] Use appropriate number of decimal places ### Sharing and Security - [ ] Set appropriate Organization-Wide Defaults (OWD) - [ ] Use role hierarchy effectively - [ ] Implement sharing rules judiciously - [ ] Use manual sharing sparingly - [ ] Leverage teams for collaboration - [ ] Implement field-level security properly - [ ] Use permission sets over profile permissions - [ ] Create permission set groups for roles - [ ] Test security model thoroughly - [ ] Document sharing architecture ## Integration Best Practices ### API Design - [ ] Use REST over SOAP for new integrations - [ ] Implement proper authentication (OAuth 2.0) - [ ] Design idempotent operations - [ ] Handle errors gracefully - [ ] Implement retry logic with exponential backoff - [ ] Use bulk APIs for large data volumes - [ ] Implement proper logging - [ ] Monitor API usage and limits - [ ] Version APIs appropriately - [ ] Document API contracts ### Middleware Usage - [ ] Use platform events for real-time integration - [ ] Implement Change Data Capture for data sync - [ ] Use External Services for declarative integration - [ ] Leverage Salesforce Connect for real-time external data - [ ] Implement proper error handling - [ ] Monitor integration health - [ ] Plan for failover scenarios - [ ] Test with production-like volumes - [ ] Document integration patterns - [ ] Consider using MuleSoft for complex scenarios ## Performance Best Practices ### Query Optimization - [ ] Use selective queries (indexed fields) - [ ] Limit query results with WHERE clauses - [ ] Avoid querying unnecessary fields - [ ] Use relationship queries efficiently - [ ] Implement pagination for large results - [ ] Cache frequently accessed data - [ ] Use aggregate queries where appropriate - [ ] Avoid complex queries in loops - [ ] Monitor query performance - [ ] Use query plan tool ### Governor Limits - [ ] Monitor and log limit usage - [ ] Implement collection processing - [ ] Use asynchronous processing for heavy operations - [ ] Batch large data operations - [ ] Optimize trigger execution - [ ] Minimize describe calls - [ ] Use custom settings/metadata for configuration - [ ] Implement proper error handling for limit exceptions - [ ] Test with large data volumes - [ ] Plan for scale from the start ### UI Performance - [ ] Minimize component initialization time - [ ] Lazy load components when possible - [ ] Use pagination for lists - [ ] Optimize images and static resources - [ ] Minimize server round trips - [ ] Use Lightning Data Service caching - [ ] Implement efficient search - [ ] Use platform cache for frequently accessed data - [ ] Monitor page performance - [ ] Test on slower connections ## Deployment Best Practices ### Version Control - [ ] Use Git for source control - [ ] Follow branching strategy (GitFlow, GitHub Flow) - [ ] Commit frequently with meaningful messages - [ ] Use pull requests for code review - [ ] Tag releases appropriately - [ ] Maintain README files - [ ] Document setup instructions - [ ] Use .gitignore properly - [ ] Store metadata in source format - [ ] Review changes before committing ### CI/CD Pipeline - [ ] Automate deployments with CI/CD - [ ] Run automated tests on commit - [ ] Use scratch orgs for development - [ ] Implement quality gates - [ ] Automate code quality checks - [ ] Deploy to multiple environments - [ ] Implement rollback procedures - [ ] Monitor deployment success - [ ] Use deployment scripts - [ ] Document deployment process ### Change Management - [ ] Follow change advisory board process - [ ] Document all changes - [ ] Test in lower environments first - [ ] Get stakeholder approval - [ ] Plan deployment windows - [ ] Communicate changes to users - [ ] Prepare rollback plans - [ ] Monitor post-deployment - [ ] Document lessons learned - [ ] Update runbooks ## Maintenance Best Practices ### Documentation - [ ] Maintain solution design documents - [ ] Document data model - [ ] Create user guides - [ ] Document integration points - [ ] Maintain runbooks - [ ] Document known issues - [ ] Create troubleshooting guides - [ ] Keep documentation up to date - [ ] Use inline code comments - [ ] Document business logic ### Monitoring - [ ] Set up login monitoring - [ ] Monitor API usage - [ ] Track performance metrics - [ ] Monitor data quality - [ ] Set up alerts for errors - [ ] Track user adoption - [ ] Monitor integration health - [ ] Review debug logs regularly - [ ] Track storage usage - [ ] Monitor governor limit usage ### Regular Maintenance - [ ] Review and optimize queries - [ ] Clean up unused metadata - [ ] Archive old data - [ ] Review security settings - [ ] Update documentation - [ ] Optimize page layouts - [ ] Review and consolidate automation - [ ] Update test classes - [ ] Review integration performance - [ ] Plan for platform updates ## User Experience Best Practices ### UI/UX Design - [ ] Follow Salesforce Lightning Design System - [ ] Create intuitive navigation - [ ] Use consistent layouts - [ ] Provide helpful error messages - [ ] Include inline help text - [ ] Make forms easy to complete - [ ] Use progressive disclosure - [ ] Test with actual users - [ ] Ensure mobile responsiveness - [ ] Consider accessibility needs ### User Adoption - [ ] Provide comprehensive training - [ ] Create user documentation - [ ] Implement gradual rollout - [ ] Gather user feedback - [ ] Create champions network - [ ] Monitor adoption metrics - [ ] Address user concerns quickly - [ ] Celebrate successes - [ ] Provide ongoing support - [ ] Iterate based on feedback ## Compliance and Governance ### Data Governance - [ ] Implement data quality rules - [ ] Define data ownership - [ ] Create data retention policies - [ ] Implement proper backups - [ ] Plan disaster recovery - [ ] Monitor data quality metrics - [ ] Implement deduplication - [ ] Control data access - [ ] Audit data changes - [ ] Document data lineage ### Compliance - [ ] Meet regulatory requirements (GDPR, HIPAA, etc.) - [ ] Implement proper encryption - [ ] Control PII access - [ ] Implement audit trails - [ ] Document compliance measures - [ ] Regular security reviews - [ ] Train users on compliance - [ ] Monitor compliance metrics - [ ] Update policies as needed - [ ] Maintain compliance documentation