Skip to content

Instantly share code, notes, and snippets.

@thebrettbarlow
Last active May 7, 2019 02:28
Show Gist options
  • Save thebrettbarlow/bdc66bfb13bba9a3eb9e4f8cd63ef6b9 to your computer and use it in GitHub Desktop.
Save thebrettbarlow/bdc66bfb13bba9a3eb9e4f8cd63ef6b9 to your computer and use it in GitHub Desktop.
# query the accounts and put them in chatty_accounts_to_move__backup.csv
soql "
select id, name, ownerid, owner.name
from account
where ownerid = '005j000000Ea93uAAB'
" -u dev1 -r csv > chatty_accounts_to_move__backup.csv &&
# cut out the Id of each account and set the new OwnerId
cat chatty_accounts_to_move__backup.csv | \
cut -d "," -f 1 | \
sed \
-e '1 s/$/,OwnerId/' \
-e '2,$ s/$/,005j000000BX4uCAAT/' > chatty_accounts_to_move.csv &&
# upsert the accounts
sfdx force:data:bulk:upsert \
--sobjecttype account \
--externalid id \
--csvfile chatty_accounts_to_move.csv \
--targetusername dev1 \
--wait 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment