UNPKG

sf-agent-framework

Version:

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

614 lines (502 loc) 11.7 kB
# OmniScript Builder Task ## Task Overview **Task**: Build OmniScript for business process **Complexity**: High **Duration**: 1-3 days **Output**: Functional OmniScript with full documentation ## Prerequisites - [ ] Process flow documented - [ ] Data requirements defined - [ ] Integration points identified - [ ] User stories approved - [ ] Test scenarios prepared ## Building Process ### Phase 1: OmniScript Setup (1 hour) #### Initial Configuration ```yaml OmniScript Properties: Name: OS_[Process]_[Type]_v1 Type: [Category] SubType: [Specific Process] Language: English Settings: - Allow Save for Later: Yes - Allow Cancel: Yes - Show Progress Bar: Yes - Enable Knowledge: Yes - Mobile Compatible: Yes ``` #### Canvas Setup ```json { "properties": { "elementTypeToHTMLTemplateList": [], "errorMessage": { "custom": true, "default": "An error occurred. Please try again." }, "trackingCustomData": { "source": "Web", "campaign": "Q1-2024" } } } ``` ### Phase 2: Step Structure Design (2 hours) #### Step Organization ```yaml Step Structure: 1. Introduction: Type: Step Elements: - Text Block (welcome message) - Disclosure (terms) 2. Customer Information: Type: Step Elements: - Text Input (firstName) - Text Input (lastName) - Email (emailAddress) - Telephone (phoneNumber) 3. Service Selection: Type: StepGroup Child Steps: 3.1 Product Choice 3.2 Configuration 3.3 Add-ons 4. Review & Confirm: Type: Review Step Show Previous Values: Yes 5. Submit: Type: Step Elements: - Integration Procedure Action - Navigate Action ``` #### Navigation Logic ```javascript // Conditional navigation example { "conditions": { "expression": "%customerType% == 'Enterprise'", "true": { "nextStep": "EnterpriseOptions" }, "false": { "nextStep": "StandardOptions" } } } ``` ### Phase 3: Element Implementation (4 hours) #### Input Elements Configuration ##### Text Input ```json { "name": "FirstName", "propSetMap": { "label": "First Name", "required": true, "maxLength": 50, "pattern": "^[a-zA-Z\\s]+$", "patternErrText": "Please enter a valid name", "placeholder": "Enter your first name" } } ``` ##### Select Element ```json { "name": "ProductType", "propSetMap": { "label": "Select Product", "required": true, "options": [ { "name": "Basic", "value": "basic" }, { "name": "Professional", "value": "pro" }, { "name": "Enterprise", "value": "enterprise" } ], "controlWidth": 6 } } ``` ##### Radio Group ```json { "name": "PreferredContact", "propSetMap": { "label": "Preferred Contact Method", "options": [ { "name": "Email", "value": "email" }, { "name": "Phone", "value": "phone" }, { "name": "SMS", "value": "sms" } ], "horizontalMode": true } } ``` #### Display Elements ##### Text Block ```json { "name": "Instructions", "propSetMap": { "text": "Please complete all required fields. Your information is secure and will not be shared.", "textKey": "InstructionsText", "HTMLTemplateId": "custom-text-template" } } ``` ##### Formula Element ```json { "name": "TotalCalculation", "propSetMap": { "formula": "(%BasePrice% * %Quantity%) * (1 - %DiscountPercent%/100)", "outputType": "Currency", "label": "Total Price" } } ``` ### Phase 4: Business Logic Implementation (3 hours) #### Validation Rules ##### Field-Level Validation ```javascript // Email validation { "name": "EmailValidation", "expression": "REGEX(%Email%, '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$')", "message": "Please enter a valid email address" } // Date range validation { "name": "DateValidation", "expression": "%StartDate% >= TODAY() && %StartDate% <= TODAY() + 90", "message": "Please select a date within the next 90 days" } ``` ##### Cross-Field Validation ```javascript // Dependent field validation { "name": "DependentValidation", "expression": "IF(%HasDependents% == true, %NumberOfDependents% > 0, true)", "message": "Please specify number of dependents" } ``` #### Conditional Visibility ```json { "name": "ConditionalSection", "propSetMap": { "show": { "expression": "%CustomerType% == 'Business' && %AnnualRevenue% > 1000000" } } } ``` #### Set Values Actions ```json { "name": "SetDefaultValues", "propSetMap": { "elementValueMap": { "Country": "United States", "Currency": "USD", "Language": "English" } } } ``` ### Phase 5: Integration Configuration (3 hours) #### DataRaptor Pre-Population ```json { "name": "LoadCustomerData", "type": "DataRaptor Extract", "propSetMap": { "bundle": "DR_CustomerData_Extract", "inputMap": { "customerId": "%ContextId%" }, "outputPath": "CustomerInfo" } } ``` #### Integration Procedure Actions ```json { "name": "ProcessOrder", "type": "Integration Procedure Action", "propSetMap": { "bundle": "IP_ProcessOrder_v1", "inputMap": { "customerData": "%CustomerInfo%", "orderDetails": "%OrderInfo%", "preferences": "%Preferences%" }, "outputPath": "ProcessResult", "postMessage": "Processing your order...", "completeMessage": "Order processed successfully!" } } ``` #### Remote Actions ```json { "name": "ValidateAddress", "type": "Remote Action", "propSetMap": { "remoteClass": "AddressValidationService", "remoteMethod": "validateAddress", "inputMap": { "street": "%Street%", "city": "%City%", "state": "%State%", "zipCode": "%ZipCode%" }, "outputPath": "ValidationResult" } } ``` ### Phase 6: User Experience Enhancement (2 hours) #### Progress Indicator ```json { "progressIndicator": { "type": "path", "showLabels": true, "completedColor": "#4bca81", "currentColor": "#0070d2", "incompleteColor": "#dddbda" } } ``` #### Custom Messaging ```javascript // Success messages { "messages": { "success": { "title": "Success!", "description": "Your request has been submitted successfully.", "variant": "success" }, "error": { "title": "Error", "description": "An error occurred. Please try again.", "variant": "error" } } } ``` #### Loading States ```json { "loadingIndicator": { "message": "Loading your information...", "spinnerSize": "medium", "showOverlay": true } } ``` ### Phase 7: Testing Implementation (4 hours) #### Unit Testing Each Step ```yaml Test Cases: Step 1 - Introduction: - Verify text displays correctly - Check disclosure acceptance required - Test navigation to next step Step 2 - Data Collection: - Test all field validations - Verify required fields - Check field dependencies - Test error messages Step 3 - Integration: - Mock integration responses - Test error scenarios - Verify data mapping - Check timeout handling ``` #### End-to-End Testing ```javascript // Test script example describe('Customer Onboarding OmniScript', () => { it('should complete full flow successfully', () => { // Step 1: Introduction clickNext(); // Step 2: Enter customer data fillField('FirstName', 'John'); fillField('LastName', 'Doe'); fillField('Email', 'john.doe@example.com'); clickNext(); // Step 3: Select services selectOption('ServiceType', 'Premium'); clickNext(); // Step 4: Review verifyReviewData(); clickSubmit(); // Verify success expectSuccessMessage(); }); }); ``` #### Performance Testing ```yaml Performance Metrics: - Initial Load: < 2 seconds - Step Transition: < 500ms - Data Save: < 1 second - Integration Call: < 3 seconds Load Testing: - Single User: Baseline performance - 10 Concurrent: < 10% degradation - 50 Concurrent: < 25% degradation ``` ### Phase 8: Advanced Features (Optional - 2 hours) #### Multi-Language Support ```json { "languageConfig": { "supportedLanguages": ["en_US", "es_ES", "fr_FR"], "defaultLanguage": "en_US", "customLabels": { "NextButton": { "en_US": "Next", "es_ES": "Siguiente", "fr_FR": "Suivant" } } } } ``` #### Document Generation ```json { "name": "GeneratePDF", "type": "DocuSign Action", "propSetMap": { "templateId": "contract-template-v1", "inputMap": { "customerName": "%FirstName% %LastName%", "contractDetails": "%OrderSummary%" }, "outputPath": "GeneratedDocument" } } ``` #### Email Notifications ```json { "name": "SendConfirmationEmail", "type": "Email Action", "propSetMap": { "emailTemplate": "OrderConfirmation", "recipients": ["%Email%"], "mergeFields": { "CustomerName": "%FirstName%", "OrderNumber": "%OrderNumber%", "TotalAmount": "%TotalPrice%" } } } ``` ## Best Practices Implementation ### 1. Error Handling ```javascript // Comprehensive error handling { "errorHandling": { "step": { "onError": "showMessage", "allowRetry": true, "logError": true }, "integration": { "timeout": 30000, "retryCount": 3, "fallbackAction": "showManualProcess" } } } ``` ### 2. Data Persistence ```json { "saveForLater": { "enabled": true, "autoSave": true, "autoSaveInterval": 60, "expirationDays": 30 } } ``` ### 3. Accessibility ```html <!-- Accessibility enhancements --> <div role="form" aria-label="Customer Information Form"> <label for="firstName" class="slds-required"> First Name <abbr title="required" aria-label="required">*</abbr> </label> <input id="firstName" type="text" required aria-required="true" aria-describedby="firstName-error" /> <div id="firstName-error" role="alert" aria-live="polite"></div> </div> ``` ## Documentation Template ### Technical Documentation ```markdown # OS_CustomerOnboarding_v1 ## Overview Multi-step process for onboarding new customers with service selection and account setup. ## Steps 1. **Introduction** - Welcome and terms acceptance 2. **Customer Info** - Basic information collection 3. **Service Selection** - Product and configuration choices 4. **Review** - Summary and confirmation 5. **Submit** - Process order and create records ## Integrations - DR_CustomerData_Extract - Pre-populate existing data - IP_ProcessOrder_v1 - Submit order for processing - Email Service - Send confirmation ## Business Rules - Email validation required - Phone number format: (xxx) xxx-xxxx - Minimum order value: $100 - Maximum discount: 20% ## Performance - Average completion time: 5 minutes - Success rate: 95% - Most common drop-off: Step 3 (Service Selection) ``` ## Deployment Checklist ### Pre-Deployment - [ ] All testing completed - [ ] Performance validated - [ ] Documentation updated - [ ] Permissions configured - [ ] Training materials ready ### Deployment Process 1. Export OmniScript package 2. Deploy to production 3. Activate OmniScript 4. Configure permissions 5. Test in production ### Post-Deployment - [ ] Smoke test completed - [ ] Monitoring enabled - [ ] Support team briefed - [ ] User feedback collected - [ ] KPIs tracking ## Success Metrics ### Development Metrics - Requirements coverage: 100% - Test pass rate: > 95% - Performance SLA met: Yes - Zero critical bugs - On-time delivery ### Business Metrics - User adoption rate - Completion rate - Average time to complete - Error rate - Customer satisfaction