diff --git a/lib/netsuite/records/custom_field_list.rb b/lib/netsuite/records/custom_field_list.rb
index b60e5f8ad..193bb4b84 100644
--- a/lib/netsuite/records/custom_field_list.rb
+++ b/lib/netsuite/records/custom_field_list.rb
@@ -110,9 +110,10 @@ def extract_custom_field(custom_field_data)
attrs = custom_field_data.clone
type = (custom_field_data[:"@xsi:type"] || custom_field_data[:type])
- if type == "platformCore:SelectCustomFieldRef"
+ case type
+ when "platformCore:SelectCustomFieldRef", "platformCore:SearchColumnSelectCustomField"
attrs[:value] = CustomRecordRef.new(custom_field_data[:value])
- elsif type == 'platformCore:MultiSelectCustomFieldRef'
+ when 'platformCore:MultiSelectCustomFieldRef', 'platformCore:SearchColumnMultiSelectCustomField'
# if there is only a single selection, `:value` will be hash not an array
attrs[:value] = if custom_field_data[:value].is_a?(Array)
custom_field_data[:value]
diff --git a/lib/netsuite/support/search_result.rb b/lib/netsuite/support/search_result.rb
index bd7071a18..2cd936c5f 100644
--- a/lib/netsuite/support/search_result.rb
+++ b/lib/netsuite/support/search_result.rb
@@ -52,9 +52,6 @@ def initialize(response, result_class, credentials)
record_list = [record_list] unless record_list.is_a?(Array)
record_list.each do |record|
- # TODO because of customFieldList we need to either make this recursive
- # or handle the customFieldList as a special case
-
record.each_pair do |search_group, search_data|
# skip all attributes: look for :basic and all :xxx_join
next if search_group.to_s.start_with?('@')
@@ -63,7 +60,25 @@ def initialize(response, result_class, credentials)
# all return values are wrapped in a
# extract the value from to make results easier to work with
- if v.is_a?(Hash) && v.has_key?(:search_value)
+ if k == :custom_field_list
+ # Here's an example of a response
+
+ #
+ #
+ # sample string value
+ #
+ #
+ #
+ #
+ #
+
+ custom_field_list = v.fetch(:custom_field)
+ custom_field_list = [custom_field_list] unless custom_field_list.is_a?(Array)
+ record[search_group][k][:custom_field] = custom_field_list.map do |custom_field|
+ custom_field[:value] = custom_field.fetch(:search_value)
+ custom_field
+ end
+ elsif v.is_a?(Hash) && v.has_key?(:search_value)
# Here's an example of a record ref and string response
#
diff --git a/spec/netsuite/actions/search_spec.rb b/spec/netsuite/actions/search_spec.rb
index 2f0abbec4..b6eff64bc 100644
--- a/spec/netsuite/actions/search_spec.rb
+++ b/spec/netsuite/actions/search_spec.rb
@@ -171,6 +171,8 @@
expect(search.results.first.internal_id).to eq('123')
expect(search.results.first.external_id).to eq('456')
expect(search.results.first.alt_name).to eq('A Awesome Name')
+ expect(search.results.first.custom_field_list.custitem_stringfield.value).to eq('sample string value')
+ expect(search.results.first.custom_field_list.custitem_apcategoryforsales.value.internal_id).to eq('4')
expect(search.results.last.email).to eq('alessawesome@gmail.com')
end
end
diff --git a/spec/support/fixtures/search/saved_search_joined_custom_customer.xml b/spec/support/fixtures/search/saved_search_joined_custom_customer.xml
index 68b3fa4d5..22d47550d 100644
--- a/spec/support/fixtures/search/saved_search_joined_custom_customer.xml
+++ b/spec/support/fixtures/search/saved_search_joined_custom_customer.xml
@@ -43,6 +43,14 @@
444-444-4444
+
+
+ sample string value
+
+
+
+
+