I am trying to create a search which does the foll...
# suitescript
p
I am trying to create a search which does the following: Takes the date from a custom field on an invoice Does a search against a custom record that has 2 dates - A start date and an end date Find the record and get the text value of a field in that custom record I am struggling on how to get this to work. I tried using the below filter but am not getting any results even though I know myDate is between the dates in a custom record:
Copy code
filters:
   [
      ["custrecord_startDate","onorafter",myDate], 
      "AND", 
      ["custrecord_endDate","onorbefore",myDate]
   ]
Any ideas how I can make this work?
b
build the search in the ui first
your range doesnt look sane
p
your right - it doesnt look sane. Need to think this through better.
k
Use within and put the two dates in together
b
same advice, build the search in the ui first
you wont be able to use within for this kind of range
e
either way, it just looks like you flipped the before/after operators, but i agree with build it in ui first, then inspect the filter expression
p
so i ended up flipping the operators as suggested and it worked, thanks for the help
👍 1