Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .forceignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ force-app/main/default/profiles/Custom%3A Marketing Profile.profile-meta.xml
force-app/main/default/profiles/Custom%3A Sales Profile.profile-meta.xml
force-app/main/default/profiles/Custom%3A Support Profile.profile-meta.xml

force-app/main/default/staticresources/SiteSamples
force-app/main/default/staticresources/SiteSamples.resource-meta.xml

# Things to ignore after a site is created in a scratch org
Expand Down
49 changes: 47 additions & 2 deletions cumulusci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,37 @@ project:
source_format: sfdx

tasks:

deploy_site_config:
description: Deploys configuration for Development.
class_path: cumulusci.tasks.salesforce.Deploy
options:
namespace_inject: $project_config.project__package__namespace
path: unpackaged/config/site
unmanaged: True

deploy_site_profile:
description: Deploys configuration for Development.
class_path: cumulusci.tasks.salesforce.Deploy
options:
namespace_inject: $project_config.project__package__namespace
path: unpackaged/config/profile
unmanaged: True

deploy_site_settings:
description: Setup the Custom Settings for the Event Site
class_path: cumulusci.tasks.apex.anon.AnonymousApexTask
options:
path: scripts/configure_event_settings.cls
apex: setSiteURL();

deploy_event_records:
description: Configure sample records for the Event app
class_path: cumulusci.tasks.apex.anon.AnonymousApexTask
options:
path: scripts/configure_event_settings.cls
apex: initializeEventSampleData();

robot:
options:
suites: robot/USTEventsDX/tests
Expand All @@ -23,5 +54,19 @@ tasks:

flows:
config_qa:
1.1:
task: deploy_qa_config
steps:
1.1:
task: deploy_qa_config
config_dev:
steps:
3:
task: deploy_event_records

config_site:
steps:
1:
task: deploy_site_config
2:
task: deploy_site_profile
3:
task: deploy_site_settings
4 changes: 2 additions & 2 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
To work on this project in a scratch org:

1. [Set up CumulusCI](https://cumulusci.readthedocs.io/en/latest/tutorial.html)
2. Run `cci flow run dev_org --org dev` to deploy this project.
3. Run `cci org browser dev` to open the org in your browser.
2. Run `cci flow run dev_org --org <org_name>` to deploy this project.
3. Run `cci org browser <org_name>` to open the org in your browser.
4 changes: 4 additions & 0 deletions docs/set-up.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
2. Select a subdomain that is available. Since you are spinning up scratch orgs you may want to start incrementing a subdomain on a theme (myevents0001...myevents0002).
3. Click "Register My Salesforce Site Domain"

## Automate the rest of setup

1. Run `cci flow run config_site --org <org_name>` to automate the rest of the setup steps.

## Create a site record

After the subdomain is finished registering create a new site record, by clicking the "New" button next to the site header. Fill in the following data and then click "Save."
Expand Down
43 changes: 43 additions & 0 deletions scripts/configure_event_settings.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
public static void initializeEventSampleData(){

UST_Event__c testEvent = new UST_Event__c (
Name = 'Test Event',
Event_Name__c = 'Test Event',
Event_Type__c = 'Admissions Event',
Event_Status__c = 'Active',
Start_Date__c = System.Today(),
End_Date__c = System.Today().addDays(7)
);
insert testEvent;

UST_Event_Instance__c testEventInstance = new UST_Event_Instance__c (
Event__c = testEvent.Id,
Active_Status__c = 'Active',
Start_Date_Time__c = System.Today(),
End_Date_Time__c = System.Today().addDays(7)
);
insert testEventInstance;

}

public static void setSiteURL(){

String siteName = 'UST_Events';

Site site = [
SELECT GuestUserId
FROM Site
WHERE Name = :siteName
];

String path = '/sites/servlet.SiteDebugMode';
PageReference pr = new PageReference(path);
pr.getParameters().put('guid', site.GuestUserId);
pr.getParameters().put('sitedebugmode', 'x');
String url = pr.getContent().toString().substringAfter('URL=').substringBefore(path);

UST_Event_Settings__c eventSettings = UST_Event_Settings__c.getOrgDefaults();
eventSettings.Community_Base_URL__c = url;
upsert eventSettings;

}
8 changes: 8 additions & 0 deletions unpackaged/config/profile/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>UST Events Profile</members>
<name>Profile</name>
</types>
<version>44.0</version>
</Package>
Loading