Consider the variable ‘locationArray’ as the array that contains location names.
let stringArr = '';
for (let i = 0; locationArray.length > i; i += 1) {
stringArr += i > 0 ? ", '" + locationArray[i] + "', 'true'" : "'" + locationArray[i] + "', 'true'";
};let locationSearchObj = search.create({
type: "location",
filters:
[
[`formulatext: DECODE({name}, ${stringArr})`, "is", "true"],
"AND",
["isinactive", "is", "F"]
],
columns:
[
search.createColumn({ name: "name", label: "Name" }),
search.createColumn({ name: "internalid", label: "Internal ID" })
]
});