Skip to content

Instantly share code, notes, and snippets.

@johndstein
Last active June 12, 2018 13:08
Show Gist options
  • Save johndstein/ee2a1c2b366885566b4f7484ff865a45 to your computer and use it in GitHub Desktop.
Save johndstein/ee2a1c2b366885566b4f7484ff865a45 to your computer and use it in GitHub Desktop.
Long Query
#!/usr/bin/env bash
set -euo pipefail
CHURCH="'012E0000000Q8x8IAC'"
FOUNDATION="'012E0000000Q8xDIAS'"
GOVERNMENT="'0124400000097hVAAQ'"
ORG="'012E0000000Q8xIIAS'"
echo "---------------------------------------------------------------------"
echo "Set the Type picklist value for the corresponding record type id"
echo "---------------------------------------------------------------------"
# !!! Need to make sure picklist values are in place !!!
Q=" select Id, RecordTypeId"
Q+=" from Account"
Q+=" where RecordTypeId in (${CHURCH},${FOUNDATION},${GOVERNMENT},${ORG})"
Q=$(echo -e "${Q}" | sed -e 's/^[[:space:]]*//')
echo "$Q"
sf-query "${Q}" \
| sed '1s/^.*$/Id,Type/' \
| sed 's/012E0000000Q8x8IAC/Church/' \
| sed 's/012E0000000Q8xDIAS/Foundation/' \
| sed 's/0124400000097hVAAQ/Government/' \
| sed 's/012E0000000Q8xIIAS/Organization/' \
| sf-update Account poll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment