is it possible to do a saved search to show me all...
# administration
k
is it possible to do a saved search to show me all my searches that use subsidiary in the criteria?
s
Not that I can think of, what is the exact use case. You could certainly loop through them each saved search and load them in a script, and read the filters if it's a one time thing.
k
we are consolidating subsidiaries and i want to see before we make changes how many searches out will be affected. Hundreds of searches and manual to go through them all but maybe a script can do it...
s
Copy code
/**
 * @NApiVersion 2.1
 * @NScriptType MapReduceScript
 * @author 
 */
define([
    'N/search'
], function (
    search
) {
    var exports = {};
    exports.getInputData = function getInputData() {
        return search.create({
            type: search.Type.SAVED_SEARCH,
            filters: [],
            columns: ['id', 'name']
        })
    }

    exports.map = function map(context) {
        let values = JSON.parse(context.value).values; //custsearch_
        search.load(values.id)._rawFilters
            .forEach((filter) => {
                if (filter.name === 'subsidiary') {
                    //do something with all these in reduce
                    context.write({
                        key: '1',
                        value: values.name
                    });
                }
            });
    }
    exports.reduce = function reduce(context) {
        //do something with the array of searches found here
    }
    return exports;
});
something like that could be worth a shot
would be missing any sub's in formulas in criteria, but formula criteria is fairly uncommon
k
thank you! i will try this!
s
try Flashlight by Strongpoint, it will tell you which fields or records are referenced by searches and reports and it shows the path as well
k
is that a paid bundle @Suitestallion?
s
they have free one and the paid one
k
thanks will look into it
p
You can do a saved search saved search. I had to do one recently to check which searches used
class
k
@PNJ i don't see subsidiary as a selection when i go that route
p
@Kmullervy something along these lines. Modify as needed
👍 1
s
Results != Filters
👍 1