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:
@@ -229,11 +229,26 @@ if ! validate_query "$FINAL_QUERY"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build the sf command
|
||||
SF_ARGS=("data" "export")
|
||||
|
||||
# Add the query
|
||||
SF_ARGS+=("--query" "$FINAL_QUERY")
|
||||
# Build the sf command based on bulk vs regular query
|
||||
if [[ "$USE_BULK" == true ]]; then
|
||||
# Use Bulk API 2.0 for large datasets
|
||||
SF_ARGS=("data" "export" "bulk")
|
||||
SF_ARGS+=("--query" "$FINAL_QUERY")
|
||||
SF_ARGS+=("--output-file" "$OUTPUT_FILE")
|
||||
SF_ARGS+=("--result-format" "$FORMAT")
|
||||
|
||||
if [[ "$WAIT_TIME" != "10" ]]; then
|
||||
SF_ARGS+=("--wait" "$WAIT_TIME")
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}Using Bulk API 2.0${NC}"
|
||||
else
|
||||
# Use regular data query for smaller datasets
|
||||
SF_ARGS=("data" "query")
|
||||
SF_ARGS+=("--query" "$FINAL_QUERY")
|
||||
SF_ARGS+=("--output-file" "$OUTPUT_FILE")
|
||||
SF_ARGS+=("--result-format" "$FORMAT")
|
||||
fi
|
||||
|
||||
# Add optional parameters
|
||||
if [[ -n "$TARGET_ORG" ]]; then
|
||||
@@ -241,26 +256,6 @@ if [[ -n "$TARGET_ORG" ]]; then
|
||||
echo -e "${CYAN}Target org: $TARGET_ORG${NC}"
|
||||
fi
|
||||
|
||||
if [[ "$USE_BULK" == true ]]; then
|
||||
SF_ARGS+=("--bulk")
|
||||
echo -e "${YELLOW}Using Bulk API${NC}"
|
||||
fi
|
||||
|
||||
if [[ "$WAIT_TIME" != "10" ]]; then
|
||||
SF_ARGS+=("--wait" "$WAIT_TIME")
|
||||
fi
|
||||
|
||||
# Set output file and format
|
||||
case "$FORMAT" in
|
||||
"csv")
|
||||
SF_ARGS+=("--output-file" "$OUTPUT_FILE")
|
||||
;;
|
||||
"json")
|
||||
SF_ARGS+=("--output-file" "$OUTPUT_FILE")
|
||||
SF_ARGS+=("--json")
|
||||
;;
|
||||
esac
|
||||
|
||||
echo -e "${CYAN}Output format: $FORMAT${NC}"
|
||||
echo -e "${CYAN}Output file: $OUTPUT_FILE${NC}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user