-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdev-setup.sh
More file actions
executable file
·125 lines (103 loc) · 5.58 KB
/
Copy pathdev-setup.sh
File metadata and controls
executable file
·125 lines (103 loc) · 5.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
help() {
echo ""
echo "USAGE:"
echo " $0 [-a <string>] [-d <integer>]"
echo ""
echo "OPTIONS:"
echo -e " -a Alias. Set a custom alias for scratch org. Default: 'dev-scratch'."
echo -e " -d Duration. Set a custom duration for a scratch org. Default: 7, min: 1, max: 30."
echo ""
echo "EXAMPLES:"
echo -e "\t $ $0 -a feature-x -d 20"
exit 1 # Exit script after printing help
}
verbose=true;
duration=15;
alias='dev-scratch';
while getopts a:d: opt
do
case "$opt" in
(a) alias="$OPTARG" ;;
(d) duration="$OPTARG" ;;
(?) help ;;
esac
done
dx() {
if [ "$verbose" = true ]
then
# Print command and run.
echo "\$ sfdx ${@/eval/}" ; sfdx "$@" ;
status=$?
else
# Suppress sfdx's output, and read the status property of the resulting JSON output instead.
result=$(sfdx "$@" --json 2> /dev/null);
status=`echo $result | sed -e 's/^.*"status"[ ]*:[ ]*//' -e 's/\,.*//'`
fi
# Exit early on error.
if [ $status -eq 1 ]
then
if [ "$verbose" = false ]
then
message=`echo $result | sed -e 's/^.*"message"[ ]*:[ ]*//' -e 's/\,.*//'`
echo " Error $message on \"$@\""
fi
exit 1;
fi
}
echo "Creating scratch org, \"$alias\"..."
sf org create scratch --definition-file config/project-scratch-def.json --alias $alias --set-default --target-dev-hub devhub --duration-days 30
sf data update record -u $alias -s Organization -w "Name='Special Authority Scratch Org'" -v "TimeZoneSidKey='America/Los_Angeles'"
sf data update record -u $alias -s User -w "Name='User User'" -v "TimeZoneSidKey='America/Los_Angeles'"
echo "Installing OmniStudio managed package"
sf package install --package "04t4W000003CjY5" --target-org $alias -w 15 --noprompt
echo "Installing Health Cloud managed package"
sf package install --package "04t4W000002V2Ub" --target-org $alias -w 15 --noprompt
echo "Set deployment user standard security"
sf org assign permsetlicense --name OmniStudio --target-org $alias
sf org assign permsetlicense --name HealthCloudGA_HealthCloudPsl --target-org $alias
sf org assign permset --name HealthCloudFoundation --target-org $alias
sf org assign permset --name DocGenDesigner --target-org $alias
sf org assign permset --name DocGenUser --target-org $alias
sf org assign permset --name BREDesigner --target-org $alias
sf org assign permset --name BRERuntime --target-org $alias
sf org assign permset --name OmniStudio_Standard_User --target-org $alias
sf org assign permset --name OmniStudio_Standard_Experience_Users --target-org $alias
sf org assign permset --name OmniStudio_Standard_User_Extras --target-org $alias
sf org assign permsetlicense --name BREDesigner --target-org $alias
sf org assign permsetlicense --name BRERuntime --target-org $alias
echo "Uploading source code..."
sf project deploy start --source-dir dev-app-pre --target-org $alias
sf project deploy start --source-dir force-app --target-org $alias --ignore-conflicts
sf project deploy start --source-dir force-app/main/default/objects --target-org $alias
sf project deploy start --source-dir force-app/main/default/queues --target-org $alias
sf project deploy start --source-dir OmniStudio-Components --target-org $alias
sf project deploy start --source-dir OmniStudio-Components/main/default/omniScripts --target-org $alias -w 30 --ignore-conflicts
sf project deploy start --source-dir dev-app-post --target-org $alias --ignore-conflicts
#sfdx force:source:tracking:reset -u $alias --noprompt
sf project reset tracking --target-org $alias --noprompt
#dx force:source:push -u $alias
sf project deploy start --target-org $alias
echo "Assigning permissions..."
sf org assign permset --name SA_Administrator --target-org $alias
sf org assign permset --name EDRD_PS_Operational_Support --target-org $alias
sf apex run --file scripts/apex/scratchorg-set-current-user.apex --target-org $alias
echo "Uploading data..."
sf force data bulk upsert --sobject Drug__c --file data/drugs.csv --external-id Drug_Code__c --wait 5 --target-org $alias
sf force data bulk upsert --sobject Account --file data/accounts.csv --external-id Id --wait 5 --target-org $alias
sf force data bulk upsert --sobject Account --file data/decs.csv --external-id Id --wait 5 --target-org $alias
sf force data bulk upsert --sobject Case --file data/cases.csv --external-id Id --wait 5 --target-org $alias
sf data import tree --files data/comm-plan.json --target-org $alias
sf apex run --target-org $alias --file scripts/apex/scratchorg-add-comm-users.apex
sf apex run --target-org $alias --file scripts/apex/scratchorg-assign-cases-to-ecs.apex
sf apex run --target-org $alias --file scripts/apex/scratchorg-add-comm-users.apex
sf apex run --target-org $alias --file scripts/apex/scratchorg-assign-cases-to-queue.apex
sf apex run --target-org $alias --file scripts/apex/scratchorg-add-form-questions.apex
sf force data bulk upsert --sobject Diagnosis__c --file data/diagnosis.csv --external-id Id --wait 5 --target-org $alias
sf force data bulk upsert --sobject Product_Health_Category__c --file data/producthealthcategories.csv --external-id Id --wait 5 --target-org $alias
sf force data bulk upsert --sobject Step__c --file data/steps.csv --external-id Id --wait 5 --target-org $alias
sf force data bulk upsert --sobject Step_Criteria__c --file data/stepcriteria.csv --external-id Id --wait 5 --target-org $alias
sf force data bulk upsert --sobject Step_Action__c --file data/stepactions.csv --external-id Id --wait 5 --target-org $alias
sf apex run --target-org $alias --file scripts/apex/scratchorg-assign-drug-default-queues.apex
echo "$alias is ready."
sf org open --target-org $alias