Created
May 7, 2014 22:02
-
-
Save mickle00/c8c31fa19e07bcf0e866 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xmltodict | |
OBJECT_NAME = 'Case_Backup.object' | |
PICKLIST_FIELD = 'Team__c' | |
def parseRecordTypes(): | |
for recordType in getRecordTypes(): | |
parseRecordType(recordType) | |
def parseRecordType(recordType): | |
for picklistField in recordType['picklistValues']: | |
if str(picklistField['picklist']) == PICKLIST_FIELD: | |
recordTypeName = recordType['fullName'] | |
picklistValues = picklistField['values'] | |
if type(picklistValues) == type([]): | |
for value in picklistValues: | |
print recordTypeName + ':' + value['fullName'] | |
else: | |
print recordTypeName + ':' + picklistValues['fullName'] | |
def getRecordTypes(): | |
f = open(OBJECT_NAME, 'r') | |
f_dict = xmltodict.parse(f.read()) | |
return f_dict['CustomObject']['recordTypes'] | |
parseRecordTypes() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment