Skip to content

Instantly share code, notes, and snippets.

View toddboyd's full-sized avatar

Todd Boyd toddboyd

View GitHub Profile
@toddboyd
toddboyd / run-apex-script.ps1
Created June 15, 2021 21:21
Run Apex PowerShell Script
# Run apex script
Write-Host -ForegroundColor green "Running apex script..."
& sfdx force:apex:execute -u $orgName -f [apex script]
if ($LASTEXITCODE -ne 0) {
exit 1
}
Write-Host ""
@toddboyd
toddboyd / populate-test-data.ps1
Created June 15, 2021 21:19
Populate Test Data PowerShell Script
# Populate test data
Write-Host -ForegroundColor green "Creating test data..."
& sfdx force:data:tree:import -u $orgName --plan [json data file]
if ($LASTEXITCODE -ne 0) {
exit 1
}
Write-Host ""
@toddboyd
toddboyd / assign-permission-set.ps1
Created June 15, 2021 21:17
Assign Permission Set PowerShell Script
# Assign permission set
Write-Host -ForegroundColor green "Assigning permission set..."
& sfdx force:user:permset:assign --permsetname [permission set name] -u $orgName
if ($LASTEXITCODE -ne 0) {
exit 1
}
Write-Host ""
@toddboyd
toddboyd / deploy-source.ps1
Created June 15, 2021 21:16
Deploy source to scratch org
# Deploy source to scratch org
Write-Host -ForegroundColor green "Deploying source to scratch org..."
& sfdx force:source:push -u $orgName
if ($LASTEXITCODE -ne 0) {
exit 1
}
Write-Host ""
@toddboyd
toddboyd / create-scratch-org.ps1
Last active June 20, 2021 17:13
Create Scratch Org PowerShell Script
param([string] $orgName, [int] $duration, [boolean]$debugMode)
if (!$orgName) {
# If no scratch org name is given, use a default name
$orgName = "defaultScratchOrgName";
}
if (!$duration) {
# if no duration is provided, use default
$duration = "7";
@toddboyd
toddboyd / Install-Package.ps1
Created June 15, 2021 21:14
Install Unlocked Package PowerShell Script
# Install package
Write-Host -ForegroundColor green "Installing package..."
& sfdx force:package:install -p [package id] -u $orgName -s AllUsers -r -w 10 -k [package password]
if ($LASTEXITCODE -ne 0) {
exit 1
}
Write-Host ""
ClientNotification.SendNotification('Sales',
'Scheduled Process Complete',
'Daily Data Import Completed with 0 Errors',
ClientNotificationType.SUCCESS,
true);
ClientNotification.SendNotification(null,
'Related Records Updated',
'4 Related Contacts were updated',
ClientNotificationType.INFO,
false);
public static void SendNotification(String application, 
String title, 
String message, 
ClientNotificationType notificationType, 
Boolean allUsers);
@toddboyd
toddboyd / jenkins-docker.md
Last active December 2, 2018 18:06
Setup jenkins docker image that can create docker images

Setup Jenkins Docker image that can create Docker images

Start the container

The following will start the container in the background with ports 8080 and 50000 mapped from the host to the container. The first volume allows the docker client on the container to access the docker server on the host. The second volume will be used to run the docker install script.

docker run -d -p 8080:8080 -p 50000:50000 \
   -v /var/run/docker.sock:/var/run/docker.sock \ 
   -v scriptvol:/scripts \
   --name jenkins jenkins/jenkins:lts