-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathconfigure_event_settings.cls
More file actions
43 lines (34 loc) · 1.25 KB
/
configure_event_settings.cls
File metadata and controls
43 lines (34 loc) · 1.25 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
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;
}