#!/bin/bash echo "🚀 Deploying Fixed Apex Controllers to Salesforce..." echo "==================================================" # Check if sf CLI is installed if ! command -v sf &> /dev/null; then echo "❌ Salesforce CLI (sf) is not installed. Please install it first." echo " Visit: https://developer.salesforce.com/tools/sfdxcli" exit 1 fi # Check if we're authenticated echo "🔐 Checking authentication..." if ! sf org display &> /dev/null; then echo "❌ Not authenticated to Salesforce. Please login first:" echo " sf org login web" exit 1 fi echo "✅ Authenticated to Salesforce" # Deploy the fixed Apex controllers echo "📦 Deploying PropertyDataController and other Apex classes..." sf project deploy start --source-dir force-app/main/default/classes --target-org $(sf org display --json | jq -r '.result.username') if [ $? -eq 0 ]; then echo "✅ Apex classes deployed successfully!" else echo "❌ Deployment failed. Please check the error messages above." exit 1 fi # Deploy the LWC component echo "⚡ Deploying LWC component..." sf project deploy start --source-dir force-app/main/default/lwc --target-org $(sf org display --json | jq -r '.result.username') if [ $? -eq 0 ]; then echo "✅ LWC component deployed successfully!" else echo "❌ LWC deployment failed. Please check the error messages above." exit 1 fi echo "" echo "🎉 Deployment Complete!" echo "======================" echo "✅ Fixed PropertyDataController deployed" echo "✅ Updated LWC component deployed" echo "✅ No more 'pcrm__View__c' field errors" echo "" echo "🔄 Now refresh your Salesforce org and test the dropdown!" echo " The dropdown should now show all 24 properties without errors." echo "" echo "📱 If you still have issues, use the debug tools in the component:" echo " 1. Click '🚀 Bypass Template' to create a working dropdown" echo " 2. Click '🔍 Check Template' to debug any remaining issues"