Bronto::Contact#get_field doesn't work
opened this issue · comments
Deleted user commented
The method Bronto::Contact#get_field isn't working for me. This is how I'm calling it:
filter = Bronto::Filter.new
filter.add_filter 'email', 'EqualsTo', 'email@example.org'
contact = Bronto::Contact.find(filter).first
filter = Bronto::Filter.new
filter.add_filter 'id', 'FIELD_ID'
field = Bronto::Field.find(filter)
puts contact.get_field(field).nil? ? 'NIL' : 'NOT NIL'
This outputs 'NIL' even when I know for a fact that the field has a value set.
Martin Gordon commented
You need to specify the fields you wish to retrieve in the Bronto::Contact.find call:
filter = Bronto::Filter.new
filter.add_filter 'id', 'FIELD_ID'
field = Bronto::Field.find(filter)
filter = Bronto::Filter.new
filter.add_filter 'email', 'EqualsTo', 'email@example.org'
contact = Bronto::Contact.find(filter, 1, field).first
puts contact.get_field(field)