高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
global without sharing class WaveLabsAppController {
 
    global String org{get; set;}
    
    global WaveLabsAppController() {       
        String forwardedHeader = ApexPages.currentPage().getHeaders().get('X-Salesforce-Forwarded-To');
        org = (forwardedHeader == null) ? ApexPages.currentPage().getHeaders().get('host') : forwardedHeader;
    }
    
    @RemoteAction
    global static String createRemoteSiteSettings(String instance) {     
        
        String remoteSiteSettingOrg = 'https://' + instance + '.salesforce.com';
        String remoteSiteSettingHeroku = WaveLabsController.URL_HEROKU;  
        //Will be created by VF Javascript
        //String remoteSiteSetting2 = 'https://c.' + instance + '.salesforce.com';
        
        CreateRemoteSiteSetting.createRemoteSiteSettings('WaveLabsApp_Org_URL', remoteSiteSettingOrg);
        CreateRemoteSiteSetting.createRemoteSiteSettings('WaveLabsApp_Jumpstartwave_URL', remoteSiteSettingHeroku);        
        //CreateRemoteSiteSetting.createRemoteSiteSettings('WaveLabsApp_OrgVF_URL', remoteSiteSetting2);
        
        return instance;
    } 
}