'Set the value of user fields. The field types will be the same.
data ... dict, with field name as key, field value as value
Returns None'

def update(self, data):

    self.loaddoc()
    all_fields = self.document.getElementsByType(UserFieldDecl)
    for f in all_fields:
        field_name = f.getAttribute('name')
        if (field_name in data):
            value_type = f.getAttribute('valuetype')
            value = data.get(field_name)
            if (value_type == 'string'):
                f.setAttribute('stringvalue', value)
            else:
                f.setAttribute('value', value)
    self.savedoc()
