For existing records, you would do something like ...
# suitescript
m
For existing records, you would do something like this:
Copy code
let filesCount = search
  .create({
    type: "vendor",
    filters: [
      ["internalidnumber", "equalto", recID],
      "AND",
      ["file.internalid", "noneof", "@NONE@"],
    ],
    columns: [
      search.createColumn({
        name: "internalid",
        join: "file",
      }),
    ],
  })
  .runPaged().count;
if (filesCount == 0) {
  throw "You must attach at least one file to the vendor record.";
}