Update data export/import scripts to use latest Salesforce CLI commands

- Updated sf-data-export to use 'sf data export bulk' instead of deprecated 'sf data export'
- Updated sf-data-export.ps1 to use 'sf data export bulk' command structure
- Updated sf-data-import to use 'sf data import bulk' for better compatibility
- All scripts now comply with the latest Salesforce CLI command structure
- Fixes compatibility issues with newer SF CLI versions
This commit is contained in:
reynold
2025-08-28 18:22:43 +08:00
parent 3e24d62fb2
commit 4bae7d48fa
3 changed files with 56 additions and 51 deletions

View File

@@ -289,12 +289,27 @@ if [[ "$VERBOSE" == true ]]; then
show_file_preview "$FILE" "$FILE_FORMAT"
fi
# Build the sf command
SF_ARGS=("data" "$OPERATION")
# Add the file and sobject
SF_ARGS+=("--file" "$FILE")
SF_ARGS+=("--sobject" "$SOBJECT")
# Build the sf command - SF CLI now uses specific commands for different operations
case "$OPERATION" in
"insert")
# For insert operations, use bulk import (works for all data types)
SF_ARGS=("data" "import" "bulk")
SF_ARGS+=("--file" "$FILE")
SF_ARGS+=("--sobject" "$SOBJECT")
;;
"update")
# For update operations, use bulk update
SF_ARGS=("data" "update" "bulk")
SF_ARGS+=("--file" "$FILE")
SF_ARGS+=("--sobject" "$SOBJECT")
;;
"upsert")
# For upsert operations, use bulk upsert
SF_ARGS=("data" "upsert" "bulk")
SF_ARGS+=("--file" "$FILE")
SF_ARGS+=("--sobject" "$SOBJECT")
;;
esac
# Add optional parameters
if [[ -n "$TARGET_ORG" ]]; then