Skip to content

Commit

Permalink
Adjusted script that generates CRMA SO
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomeandrey committed May 24, 2024
1 parent 7bb9ad6 commit 9e21bb5
Showing 1 changed file with 10 additions and 31 deletions.
41 changes: 10 additions & 31 deletions scripts/automations/create_crma_scratch_org.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,48 +41,27 @@ echo "📜 CRMA Scratch Org Credentials"
sf org display --target-org "$SCRATCH_ORG_ALIAS" --verbose --json >> "$orgCredentialsFile"
cat "$orgCredentialsFile"

# Resolve ".env" file for the scratch org (this properly resolves 'SF_USERNAME' & 'SF_INSTANCE_URL' variables)
echo "$SCRATCH_ORG_ALIAS" | bash ./scripts/deploy/pre/custom/resolve_env_variables.sh

# Grab newly created scratch org username
SF_USERNAME=$(bash ./scripts/util/get_target_org_username.sh)
echo "CRMA username: $SF_USERNAME"

# Set custom user name
sf data update record \
--sobject "User" \
--where "Username='$SF_USERNAME'" \
--values "FirstName='Admin' LastName='CRMA' Country='United States'" \
--target-org "$SCRATCH_ORG_ALIAS"

# Determine OS and define 'sed' command based on OS
OS="$(uname)"
if [[ "$OS" == "Darwin" ]]; then
# MacOS
echo "SED command is adapted for Mac OS."
SED_COMMAND="sed -i '' "
else
# Linux
echo "SED command is adapted for Linux OS."
SED_COMMAND="sed -i "
fi

# Make sure that 'minlopro-crma' folder is un-ignored in '.forceignore' file
$SED_COMMAND '/minlopro-crma/ s/^/#/' ".forceignore"
--sobject "User" \
--where "Username='$SF_USERNAME'" \
--values "FirstName='Admin' LastName='CRMA' Country='United States'" \
--target-org "$SCRATCH_ORG_ALIAS"

# Deploy 'minlopro-crma' folder content
sf project generate manifest \
--source-dir "src/minlopro-crma" \
--name "manifests/package.xml"
echo "$SCRATCH_ORG_ALIAS" | bash ./scripts/deploy/deploy.sh
echo "$SCRATCH_ORG_ALIAS" | bash ./scripts/crm-analytics/deploy.sh

# Assign remaining permission sets
sf org assign permset \
--name "CRMA_ObjectsAccess" \
--name "CrmAnalyticsAdmin" \
--name "CrmAnalyticsUser" \
--target-org "$SCRATCH_ORG_ALIAS" \
--on-behalf-of "$SF_USERNAME"
--name "CRMA_ObjectsAccess" \
--name "CrmAnalyticsAdmin" \
--name "CrmAnalyticsUser" \
--target-org "$SCRATCH_ORG_ALIAS" \
--on-behalf-of "$SF_USERNAME"

# Deactivate all duplicate rules
echo "$SCRATCH_ORG_ALIAS" | bash ./scripts/automations/deactivate_all_duplicate_rules.sh
Expand Down

0 comments on commit 9e21bb5

Please sign in to comment.