Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly extract external_id from advanced search results #478

Merged
merged 1 commit into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/netsuite/support/search_result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def initialize(response, result_class, credentials)
record[:basic][:internal_id] = record[:basic][:internal_id][:@internal_id]
end

if record[:basic][:external_id]
record[:basic][:external_id] = record[:basic][:external_id][:@external_id]
end

result_wrapper = result_class.new(record.delete(:basic))
result_wrapper.search_joins = record
results << result_wrapper
Expand Down
2 changes: 2 additions & 0 deletions spec/netsuite/actions/search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@

expect(search.results.size).to eq(2)
expect(search.current_page).to eq(1)
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.last.email).to eq('[email protected]')
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
<platformCore:searchRowList>
<platformCore:searchRow xmlns:listRel="urn:relationships_2012_1.lists.webservices.netsuite.com" xsi:type="listRel:CustomerSearchRow">
<listRel:basic xmlns:platformCommon="urn:common_2012_1.platform.webservices.netsuite.com">
<platformCommon:internalId>
<platformCore:searchValue internalId="123"/>
</platformCommon:internalId>
<platformCommon:externalId>
<platformCore:searchValue externalId="456"/>
</platformCommon:externalId>
<platformCommon:altName>
<platformCore:searchValue>A Awesome Name</platformCore:searchValue>
</platformCommon:altName>
Expand Down Expand Up @@ -84,4 +90,4 @@
</platformCore:searchResult>
</searchResponse>
</soapenv:Body>
</soapenv:Envelope>
</soapenv:Envelope>