jen
06/18/2020, 8:17 PMrunPaged() then fetch() to get pages of results. My issue is that I have multiple formulatext fields, and I'm only ending up with one, as they are being indexed by name from the searchColumn, and of course they all have the name formulatextSandii
06/18/2020, 8:21 PMresult.getValue(result.columns[0]) , columns[1] etc. If you know the indexes of the columns, maybe just use the same column array for both the building and retrieval.jen
06/18/2020, 8:50 PMjen
06/18/2020, 8:52 PMvar pages = tx_search.runPaged({pageSize: 4000});
// Go through each page of results.
for(var p = 0; p < pages.pageRanges.length; p++) {
// Get a page of results.
var page = pages.fetch(p);
// At this point, there is only one formulatext field left (the others are overwritten)
}Sandii
06/18/2020, 8:54 PMSandii
06/18/2020, 9:03 PMlet searchObj = search.create({
type: 'customrecord_blah',
filters: ['internalid', 'anyof', '1234'],
columns: [
search.createColumn({
name: 'formulatext',
formula: '{custrecord_blah_item}'
}),
search.createColumn({
name: 'formulatext',
formula: '{custrecord_blah_location}'
}),
]
});
let res = searchObj.runPaged().fetch({index: 0}).data;
let result = res[0];
let colValue1 = result.getValue(result.columns[0]);
let colValue2 = result.getValue(result.columns[1]);jen
06/18/2020, 9:08 PMSandii
06/18/2020, 9:09 PMjen
06/18/2020, 9:09 PMjen
06/18/2020, 9:09 PMThey don't just get lost, the resultSet does not overwrite columns regardless of their name.
jen
06/18/2020, 9:09 PMSandii
06/18/2020, 9:10 PMjen
06/18/2020, 9:10 PMjen
06/18/2020, 9:10 PMjen
06/18/2020, 9:11 PMSandii
06/18/2020, 9:11 PMSandii
06/18/2020, 9:12 PMjen
06/18/2020, 9:12 PMjen
06/18/2020, 9:13 PMjen
06/18/2020, 9:13 PMThe maximum number of results in a ResultSet object is 4000. If a search matches more than 4000 results, you must use Search.runPaged(options) or Search.runPaged.promise(options) to retrieve the full set of results.
Sandii
06/18/2020, 9:13 PMjen
06/18/2020, 9:15 PMSandii
06/18/2020, 9:15 PMbattk
06/18/2020, 9:20 PMjen
06/18/2020, 9:20 PMjen
06/18/2020, 9:20 PMbattk
06/18/2020, 9:20 PMjen
06/18/2020, 9:21 PMjen
06/18/2020, 9:21 PMSandii
06/18/2020, 9:23 PMrun().each or run().getRange() with getValue calls or toJSON() then reading the properties off of each result.jen
06/18/2020, 9:25 PMjen
06/18/2020, 9:25 PMSandii
06/18/2020, 9:25 PM//array of results
let res = transactionSearchObj.runPaged().fetch({index: 4}).data;
res.forEach(function (result){
let values = result.toJSON().values; //you would see formulatext and formulatext_1 properties here
})battk
06/18/2020, 9:26 PMbattk
06/18/2020, 9:27 PMSandii
06/18/2020, 9:27 PMbattk
06/18/2020, 9:27 PMbattk
06/18/2020, 9:27 PMbattk
06/18/2020, 9:28 PMbattk
06/18/2020, 9:28 PMjen
06/18/2020, 9:30 PMjen
06/18/2020, 9:30 PMSandii
06/18/2020, 9:40 PMjen
06/18/2020, 9:41 PMjen
06/18/2020, 9:41 PMsearch.createColumn({name: 'formulatext_1', formula: '', label: 'name of my column'}),jen
06/18/2020, 9:41 PMjen
06/18/2020, 9:42 PMsearch.createColumn({name: 'formulatext_1', formula: '\'\'', label: 'name of my column'}),jen
06/18/2020, 9:42 PMSandii
06/18/2020, 9:42 PMjen
06/18/2020, 9:42 PMjen
06/18/2020, 9:42 PMjen
06/18/2020, 9:42 PMjen
06/18/2020, 9:43 PMjen
06/18/2020, 9:43 PMSandii
06/18/2020, 9:44 PMjen
06/18/2020, 9:44 PMjen
06/18/2020, 9:44 PM