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

Fix accessing custom field values returned in advanced search results #480

Merged
merged 2 commits into from
Jul 16, 2021

Conversation

cgunther
Copy link
Contributor

NetSuite seems to wrap values in a searchValue element rather than just value, breaking the ability to access those values the same in an advanced search as compared to either a basic search or simple get.

This was already handled for standard fields, but not custom fields:

record[search_group][k] = v[:search_value]

Previously, you'd access the value via my_record.custom_field_list.my_custom_field.attributes.fetch(:search_value), and if it was a CustomRecordRef, you'd get a raw hash back, not an instance of CustomRecordRef.

Now, you'd access the value via my_record.custom_field_list.my_custom_field.value, so it's consistent across get, basic, and advanced searches, plus you'd get an instance of CustomRecordRef, where appropriate.

This originally surfaced in #470, but we're taking that in a different direction, so figured I'd address this separately.

cgunther and others added 2 commits July 12, 2021 17:01
NetSuite seems to wrap values in a `searchValue` element rather than
just `value`, breaking the ability to access those values the same in an
advanced search as compared to either a basic search or simple `get`.

Previously, you'd access the value via
`my_record.custom_field_list.my_custom_field.attributes.fetch(:search_value)`,
and if it was a `CustomRecordRef`, you'd get a raw hash back, not an
instance of `CustomRecordRef`.

Now, you'd access the value via
`my_record.custom_field_list.my_custom_field.value`, so it's consistent
across `get`, basic, and advanced searches, plus you'd get an instance
of `CustomRecordRef`, where appropriate.
@iloveitaly
Copy link
Member

Great change! Thanks. Took a long time to review and get merged because I wanted to run some manual tests against some netsuite accounts. Sorry about the delay.

@iloveitaly iloveitaly merged commit 1af5545 into NetSweet:master Jul 16, 2021
@cgunther
Copy link
Contributor Author

All good! Thanks for the merge.

@cgunther cgunther deleted the search-custom-result-column branch July 19, 2021 13:17
diegopolido pushed a commit to penrosehill/netsuite that referenced this pull request Oct 7, 2021
…NetSweet#480)

NetSuite seems to wrap values in a `searchValue` element rather than
just `value`, breaking the ability to access those values the same in an
advanced search as compared to either a basic search or simple `get`.

Previously, you'd access the value via
`my_record.custom_field_list.my_custom_field.attributes.fetch(:search_value)`,
and if it was a `CustomRecordRef`, you'd get a raw hash back, not an
instance of `CustomRecordRef`.

Now, you'd access the value via
`my_record.custom_field_list.my_custom_field.value`, so it's consistent
across `get`, basic, and advanced searches, plus you'd get an instance
of `CustomRecordRef`, where appropriate.

Co-authored-by: Michael Bianco <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants