Browse files

Added samples relating to new Settings component types.

  • Loading branch information...
1 parent 7c41390 commit b50a13cdcb407a804043a73fdd312f78df41ee3c Andrew Fawcett committed Mar 10, 2013
View
16 apex-mdapi/src/classes/MetadataService.cls
@@ -1087,17 +1087,21 @@ public class MetadataService {
}
public class RecordTypePicklistValue {
public String picklist;
- public MetadataService.PicklistValue[] values;
+ public MetadataService.PicklistValue[] values;
private String[] picklist_type_info = new String[]{'picklist','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] values_type_info = new String[]{'values','http://soap.sforce.com/2006/04/metadata','PicklistValue','0','-1','false'};
private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
private String[] field_order_type_info = new String[]{'picklist','values'};
}
- public class AddressSettings {
+ public class AddressSettings extends Metadata {
+ public String type = 'AddressSettings';
+ public String fullName;
public MetadataService.CountriesAndStates countriesAndStates;
+ private String[] type_att_info = new String[]{'xsi:type'};
+ private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] countriesAndStates_type_info = new String[]{'countriesAndStates','http://soap.sforce.com/2006/04/metadata','CountriesAndStates','1','1','false'};
private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
- private String[] field_order_type_info = new String[]{'countriesAndStates'};
+ private String[] field_order_type_info = new String[]{'fullName', 'countriesAndStates'};
}
public class describeMetadata_element {
public Double asOfVersion;
@@ -2193,7 +2197,9 @@ public class MetadataService {
private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
private String[] field_order_type_info = new String[]{'assignRecordIdToReference','connector','faultConnector','inputAssignments','object_x'};
}
- public class CaseSettings {
+ public class CaseSettings extends Metadata {
+ public String type = 'CaseSettings';
+ public String fullName;
public String caseAssignNotificationTemplate;
public String caseCloseNotificationTemplate;
public String caseCommentNotificationTemplate;
@@ -2220,6 +2226,8 @@ public class MetadataService {
public Boolean showFewerCloseActions;
public Boolean useSystemEmailAddress;
public MetadataService.WebToCaseSettings webToCase;
+ private String[] type_att_info = new String[]{'xsi:type'};
+ private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] caseAssignNotificationTemplate_type_info = new String[]{'caseAssignNotificationTemplate','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] caseCloseNotificationTemplate_type_info = new String[]{'caseCloseNotificationTemplate','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] caseCommentNotificationTemplate_type_info = new String[]{'caseCommentNotificationTemplate','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
View
40 apex-mdapi/src/classes/MetadataServiceExamples.cls
@@ -188,7 +188,45 @@ public with sharing class MetadataServiceExamples
MetadataService.UpdateMetadata ut = new MetadataService.UpdateMetadata();
ut.currentName='Lead.picklist__c';
ut.metadata= customField;
- MetadataService.AsyncResult[] results = service.updateMetadata(new List<MetadataService.updateMetadata> {ut});
+ MetadataService.AsyncResult[] results = service.updateMetadata(new List<MetadataService.UpdateMetadata> {ut});
+ }
+
+ public static void createAddressSettings()
+ {
+ MetadataService.MetadataPort service = createService();
+ MetadataService.AddressSettings addressSettings = new MetadataService.AddressSettings();
+ addressSettings.fullName = 'Address';
+ addressSettings.countriesAndStates = new MetadataService.CountriesAndStates();
+ MetadataService.Country us = new MetadataService.Country();
+ us.active = true;
+ us.integrationValue = 'United States';
+ us.isoCode = 'US';
+ us.label = 'United States';
+ MetadataService.State stateAL = new MetadataService.State();
+ stateAL.active = true;
+ stateAL.integrationValue = 'Alabama';
+ stateAL.isoCode = 'AL';
+ stateAL.label = 'Alabama';
+ MetadataService.State stateAK = new MetadataService.State();
+ stateAK.active = true;
+ stateAK.integrationValue = 'Alaska';
+ stateAK.isoCode = 'AK';
+ stateAK.label = 'Alaska';
+ us.states = new List<MetadataService.State> { stateAL, stateAK };
+ addressSettings.countriesAndStates.countries = new List<MetadataService.Country> { us };
+ MetadataService.AsyncResult[] results = service.create(new List<MetadataService.Metadata> {addressSettings});
+ }
+
+ public static void updateCaseSettings()
+ {
+ MetadataService.MetadataPort service = createService();
+ MetadataService.CaseSettings caseSettings = new MetadataService.CaseSettings();
+ caseSettings.fullName = 'Case';
+ caseSettings.notifyOwnerOnCaseComment = true;
+ MetadataService.UpdateMetadata updateMetadata = new MetadataService.UpdateMetadata();
+ updateMetadata.currentName='Case.settings';
+ updateMetadata.metadata= caseSettings;
+ MetadataService.AsyncResult[] results = service.updateMetadata(new List<MetadataService.UpdateMetadata> { updateMetadata });
}
public static MetadataService.MetadataPort createService()
View
2 apex-mdapi/src/package.xml
@@ -26,5 +26,5 @@
<members>*</members>
<name>StaticResource</name>
</types>
- <version>27.0</version>
+ <version>24.0</version>
</Package>

0 comments on commit b50a13c

Please sign in to comment.