Netsuite Saved Search: Search value based on column directly (not using internal id)
Hello friends,
When you load a saved search and saved search contains columns with formula then it is
easier to get using columns (not by internal id/ join).In this approach if you make any change
in saved search column or sequence of column then change is also required in script.
You might already know how to get value from a saved search using internal id / joins.
This post is useful if you want to get value from a saved search using columns.
Here, you have to get column first using "result.columns" and storing in a variable:
var myColumns = result.columns;
use this myColumns variable to access all columns in saved search .
In below code, getting value from 0th and 1st column of the search.
var mySearch = search.load({
id: 'customsearch_my_search_with_formula_col'
});
var resultset = mySearch.run();
var searchResult = resultset.getRange({
start: 0,
end: 1000
});
for (var i = 0; i < searchResult.length; i++){
var result = searchResult[i];
var myColumns = result.columns;
var column0= result.getValue(myColumns[0]);
var column1= result.getValue(myColumns[1]);
}
Please let us know if you face any issue.
Thanks
Team Netsuite Guru
Download Netsuite Guru Android App
Follow Me on Linkedin
Our FB Page
When you load a saved search and saved search contains columns with formula then it is
easier to get using columns (not by internal id/ join).In this approach if you make any change
in saved search column or sequence of column then change is also required in script.
You might already know how to get value from a saved search using internal id / joins.
This post is useful if you want to get value from a saved search using columns.
Here, you have to get column first using "result.columns" and storing in a variable:
var myColumns = result.columns;
use this myColumns variable to access all columns in saved search .
In below code, getting value from 0th and 1st column of the search.
var mySearch = search.load({
id: 'customsearch_my_search_with_formula_col'
});
var resultset = mySearch.run();
var searchResult = resultset.getRange({
start: 0,
end: 1000
});
for (var i = 0; i < searchResult.length; i++){
var result = searchResult[i];
var myColumns = result.columns;
var column0= result.getValue(myColumns[0]);
var column1= result.getValue(myColumns[1]);
}
Please let us know if you face any issue.
Thanks
Team Netsuite Guru
Download Netsuite Guru Android App
Follow Me on Linkedin
Our FB Page
Comments
Post a Comment
Thanks for you message, please join us on Facebook and Linkedin