Reputation: 281
I have made a userEvent
script (afterSubmit
function) on Invoice record. In my script i m creating a search in which in m applying 2 filters on startdate
and enddate
. I actually need to filter out the line that have startdate
and enddate
in which my invoice's trandate
lays.
For example if my trandate is 28/5/2020, than results should show only this line as follows: (because my date resides in between that specific line's start date and end date)
Kindly help/suggest anything, I m confused because my results comes out as an empty array when I apply the following code:
my code:
/* search */
var ssFilters = [];
// /* START date */
ssFilters.push(search.createFilter({
"name": "custrecord25",// start date
"operator": search.Operator.ONORAFTER,
"values": invTranDate
}));
// /* END date */
ssFilters.push(search.createFilter({
"name": "custrecord26",// end date
"operator": search.Operator.ONORBEFORE,
"values": invTranDate
}));
Upvotes: 1
Views: 2450
Reputation: 827
You only need to use one filter and will need to use the WITHIN operator:
ssFilters.push(search.createFilter({
"name": "custrecord26",
"operator": search.Operator.WITHIN,
"values": [startDate, endDate]
}));
Good luck!
Upvotes: 3