UNPKG

sf-agent-framework

Version:

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

244 lines (177 loc) 5.44 kB
# Adoption Tracker Utility - Agent Instructions ## Purpose This utility provides instructions for AI agents to generate comprehensive adoption tracking and analytics solutions for Salesforce organizations, helping measure and improve platform utilization. ## Agent Instructions ### When to Generate Adoption Tracking Generate adoption tracking components when: - Organizations need to measure Salesforce user engagement - Executive dashboards require adoption metrics - Gamification or incentive programs are being implemented - User training effectiveness needs to be measured - License optimization analysis is required - Change management initiatives need tracking ### Core Components to Generate #### 1. Adoption Metrics Engine Generate an Apex class that: - Tracks login frequency and patterns - Measures feature utilization rates - Calculates data quality contributions - Monitors process compliance - Computes weighted adoption scores - Analyzes usage trends over time #### 2. User Behavior Tracking Create Lightning Web Components that: - Capture user interactions and clicks - Track time spent on different features - Monitor navigation patterns - Record feature discovery and usage - Collect performance metrics - Respect user privacy settings #### 3. Data Collection Framework Implement tracking mechanisms for: - Login history analysis - Object and field usage statistics - Report and dashboard utilization - Mobile app engagement - API usage patterns - Custom feature adoption ### Configuration Requirements #### Custom Metadata Types Generate custom metadata for: ```yaml Adoption_Settings__mdt: - Tracking_Enabled__c (Checkbox) - Retention_Days__c (Number) - Batch_Size__c (Number) - Feature_List__c (Long Text Area) - Scoring_Algorithm__c (Picklist) Adoption_Weights__mdt: - Metric_Type__c (Picklist) - Weight__c (Number) - Active__c (Checkbox) - Description__c (Text) ``` #### Custom Objects Create objects for: ```yaml Adoption_Event__c: - User__c (Lookup to User) - Feature__c (Text) - Action__c (Text) - Timestamp__c (DateTime) - Session_Id__c (Text) - Metadata__c (Long Text Area) Adoption_Score__c: - User__c (Lookup to User) - Period__c (Text) - Login_Score__c (Number) - Feature_Score__c (Number) - Data_Score__c (Number) - Overall_Score__c (Number) - Calculation_Date__c (Date) ``` ### Implementation Patterns #### Batch Processing Pattern For large-scale adoption calculations: 1. Implement Database.Batchable interface 2. Process users in chunks of 200 3. Use stateful batch for aggregation 4. Schedule daily/weekly calculations 5. Handle governor limits appropriately #### Real-time Tracking Pattern For immediate adoption insights: 1. Use Platform Events for tracking 2. Implement event subscribers 3. Update metrics asynchronously 4. Cache frequently accessed data 5. Minimize performance impact #### Privacy-First Pattern Ensure compliance by: 1. Implementing opt-out mechanisms 2. Anonymizing sensitive data 3. Respecting data retention policies 4. Providing data export capabilities 5. Following GDPR/CCPA requirements ### Dashboard Components to Generate #### Executive Dashboard Create components showing: - Organization-wide adoption score - Department/team comparisons - Feature adoption trends - User segmentation analysis - License utilization rates - ROI metrics #### Manager Dashboard Include views for: - Team member adoption scores - Individual progress tracking - Training needs identification - Performance correlations - Coaching opportunities #### User Dashboard Display personal metrics: - Individual adoption score - Feature usage history - Achievement badges - Peer comparisons (anonymized) - Improvement suggestions ### Integration Points #### Chatter Integration - Post adoption milestones - Share team achievements - Announce champions - Provide tips and tricks #### Email Integration - Send periodic adoption reports - Alert on score changes - Notify achievements - Share best practices #### Analytics Integration - Export to Tableau/PowerBI - Create Einstein Analytics datasets - Generate predictive models - Identify adoption patterns ### Best Practices to Implement 1. **Performance Optimization** - Use selective queries with indexes - Implement efficient caching strategies - Batch process large datasets - Minimize synchronous operations 2. **Data Quality** - Validate tracking data integrity - Handle edge cases gracefully - Implement error recovery - Log anomalies for review 3. **User Experience** - Make tracking transparent - Provide value to users - Minimize intrusion - Offer clear benefits 4. **Scalability** - Design for growth - Handle millions of events - Optimize storage usage - Plan for archival ### Error Handling Instructions Implement comprehensive error handling: 1. Catch and log all exceptions 2. Provide fallback mechanisms 3. Alert administrators of issues 4. Ensure data consistency 5. Implement retry logic ### Testing Requirements Generate test classes that: 1. Cover all tracking scenarios 2. Test batch processing 3. Validate calculations 4. Verify privacy controls 5. Ensure performance standards ### Security Considerations Implement security measures: 1. Enforce CRUD/FLS in all queries 2. Validate user permissions 3. Encrypt sensitive data 4. Implement sharing rules 5. Audit data access