Trying to do a beforeLoad UE script to run on an a...
# suitescript
s
Trying to do a beforeLoad UE script to run on an assembly that loads a saved search, pulls a value from the search, then writes it to a field on the assy record. I think the search is loading properly as when i push a filter to filter by internal ID, i get one result as expected and when i dont filter by internal ID i get a bunch of results (confirmed this by returning the .length of the search results with and without the filter being pushed). However, i cannot grab any values form the search. It just says getValue is not defined
n
searchResults[0].getValue({name:<the column name>}); searchResults will be an array of results. You may also need to include any necessary join our summary values too if your search uses them.
s
When i return columns using `searchResults.columns`i see all the columns available. I threw in a
var assID = searchResults[0].getValue({name: 'internalid'});
but it says getValue is undefined
tried this too same error`var assID = searchResults[0].getValue({name: 'internalid', join: 'item'});`
b
name your variables better, searchResults is a search.ResultSet, which is not an array of search.Result
s
will give that a whirl @battk
r
try using
runPaged
, like so. with larger result sets, you'll need it.
s
For the purpose of this script, the expected result will only be one row of results being returned. will look into your suggestion though.
r
then use the
each
iterator.
return false
will return one result. otherwise you want to
return true
.
👍 1