def _get_email_values(row, fields, currentList): _addresses = [] # !! code for retrieving domain descriptions, assuming we will # !! potentially use a 'list' of emails contained in a field's Domain Description # # for each recipient in semi-colon delimited list... currentAddresses = currentList.split(';') for _address in currentAddresses: # if 'recipient' is targeting a field name that exists in the attributes... if _address in row.fields: # get value from attributes # # if field is a domain !!AND!! value does not contain '@' (meaning the code is already an email) # then go get domain description # lookup = row.attributes[_address] if lookup is not None: if '@' in lookup: # lookup is already an address, use that _addresses.append(lookup) else: for field in fields: if field['name'] == _address and field['domain'] is not None: if field['domain']['type'] == 'codedValue': # re-build domain into dictionary dCodedValues = {} for codedValue in field['domain']['codedValues']: dCodedValues[str(codedValue['code'])] = codedValue['name'] # retrieve value from dictionary addressFromDomain = dCodedValues[lookup] # split to list addressesAsList = addressFromDomain.split(';') # add each item from list for address in addressesAsList: _addresses.append(address) break else: pass else: pass else: pass else: # just use provided string _addresses.append(_address) #print(_addresses) return _addresses