Hi guys. I have a unique case where I want to upda...
# suitescript
d
Hi guys. I have a unique case where I want to update the value of a saved search result. Let’s say I’m looping through my results and I get to searchResults[i].getValue(‘someValue’), I want to update that value of that result. I tried searchResults[i].getValue(‘someValue’) = newValue, but get an error that seems like getValue doesn’t like being on the left side of the =. Is there any way to achieve this other than having to create my own object?
s
No, create your own object, not sure what the use case would be for the behavior you originally intended.
s
With NFT, you simply map the search result, returning whatever you want (e.g. modifying the object to return a new object)
something like
LazySearch.from(mysearchobj).map(nsSearchResult2obj()).map((result) => result.fieldname = newValue; return result)
d
The use case is that we are modifying existing code and did not want to interrupt logic or make drastic changes to the code. At any rate, it is not feasible and creating our own object and heavily modifying the code is our only option.