Skip to content

Instantly share code, notes, and snippets.

@bethbrains
Last active March 26, 2024 11:10
Show Gist options
  • Save bethbrains/7897ebab7db7efaf34cf279cde8a165d to your computer and use it in GitHub Desktop.
Save bethbrains/7897ebab7db7efaf34cf279cde8a165d to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
echo 'Installing Package 1: Contacts & Organizations...'
sfdx force:package:install -i 04t80000000gYcf -w 100
if [ "$?" = "0" ]; then
echo 'Installation of Package 1 complete...'
else
echo 'Installation failed.'
exit 1
fi
echo 'Installing Package 2: Households...'
sfdx force:package:install -i 04t80000000jYrO -w 100
if [ "$?" = "0" ]; then
echo 'Installation of Package 2 complete...'
else
echo 'Installation failed.'
exit 1
fi
echo 'Installing Package 3: Recurring Donations...'
sfdx force:package:install -i 04t80000000tpCB -w 100
if [ "$?" = "0" ]; then
echo 'Installation of Package 3 complete...'
else
echo 'Installation failed.'
exit 1
fi
echo 'Installing Package 4: Relationships...'
sfdx force:package:install -i 04t80000000tpCG -w 100
if [ "$?" = "0" ]; then
echo 'Installation of Package 4 complete...'
else
echo 'Installation failed.'
exit 1
fi
echo 'Installing Package 5: Affiliations...'
sfdx force:package:install -i 04t80000001AVBM -w 100
if [ "$?" = "0" ]; then
echo 'Installation of Package 5 complete...'
else
echo 'Installation failed.'
exit 1
fi
echo 'Deploying record types...'
curl -O -L https://github.com/SalesforceFoundation/Cumulus/archive/master.zip
unzip master.zip
sfdx force:mdapi:deploy -d Cumulus-master/unpackaged/pre/account_record_types/ -w 100
if [ "$?" = "0" ]; then
echo 'Deployment of Account Record Types complete...'
else
echo 'Deployment failed.'
exit 1
fi
sfdx force:mdapi:deploy -d Cumulus-master/unpackaged/pre/opportunity_record_types/ -w 100
if [ "$?" = "0" ]; then
echo 'Deployment of Opportunity Record Types complete...'
else
echo 'Deployment failed.'
exit 1
fi
rm -rf Cumulus-master
rm master.zip
echo 'Installing Package 6: Core NPSP...'
sfdx force:package:install -i 04t1Y000001I8rn -w 100
if [ "$?" = "0" ]; then
echo 'Installation of Package 6 complete...'
else
echo 'Installation failed.'
exit 1
fi
# note this is the version ID as of 9/27/2017
# it updates every 2 weeks
# depending on what you actually need, you may/may not want to go get the newest ID from
# https://github.com/SalesforceFoundation/Cumulus/releases
echo "Done installing NPSP! Would you like to open your scratch org now? [Y/N]"
read response
if [ "$response" == "Y" ]; then
sfdx force:org:open
exit 1
fi
@manwe651
Copy link

Love the script! Couple thoughts though:

  • Do you know if package installations can be done in parallel? If so it might be nice to add some parallelization to the script
  • Is there a reason to not deploy opp and account record types at the same time?
  • Also what about a properties file that contains the version ids for each package?
  • People might want to use this script as part of their CI, maybe not have a blocking input operation at the very end? Or at least an option to run the script without the prompt.

@MellifluousBee
Copy link

This is great. Thank you so much. I want to point out that the -i is deprecated, and --package should be used instead. Where did you get the package ids, bethbrains?

@MellifluousBee
Copy link

For anyone reading this in the future, I found the answer to my question. Connect to an org that has the latest version of NPSP via sfdx. Then run sfdx force:package:installed:list -u <alias|username>. You can get the Package Version Id from the output in the command line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment