I am trying to search for a record using a custom ...
# suitescript
m
I am trying to search for a record using a custom field, but I don't get any results. Is there a way to see the records as if you view rational databases or even excel?
b
i have no idea what you are describing, share the code
m
Copy code
var refID = context.newRecord.getValue("tranid");
    log.debug({title: "refID", details: refID});

    var srch = search.create({
      type: search.Type.INVENTORY_ADJUSTMENT,
      filters: [["custbody3", search.Operator.CONTAINS, refID.toString()]],
    });

    var res = srch.run();

    log.debug({ title: "result", details: res });
logs
{"columns":[]}
every time
b
thats not how you do searches
at all basically
m
could you point me to how please
b
first step should probably be to make the search in the ui, so you can see the data you are working with
m
then load and run?
b
importantly you should figure out which filter operators to use
for example,
contains
is a filter for text fields
only use it on text fields
m
Yeah, I am stuck at that part. If I created a search from the UI, can I see the code it generated?
b
i personally load the search i created in code and then log its filters and columns so i can create it myself
m
ok, will try that, thanks ❤️
b
the chrome search export extension is another option, though i personally disagree with the code it generates, it does dumb things that people are copying and pasting
🤣 3
m
It worked with the code generated from the first extension. Thanks very much.
w
@battk, please enlighten me... (from an avid search export user) 🙂 I usually replace filter operators with enums....
b
the code it generates uses both a paged search and a result set search, it should only do 1
👍 1
s
the building of the search itself is fine, its the running part that I don't use