Skip to content

Instantly share code, notes, and snippets.

@mickle00
Created May 7, 2014 22:02
Show Gist options
  • Save mickle00/c8c31fa19e07bcf0e866 to your computer and use it in GitHub Desktop.
Save mickle00/c8c31fa19e07bcf0e866 to your computer and use it in GitHub Desktop.
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