Reputation: 771
I want to create an custom search using Suite Script 2.0 version with the Filter Condition as an Formula Date Field with NVAL2 Function
I'm achieving this search on the UI as Saved Searches but i want create it on the Code itself.
Search Filter Created on the UI(Saved Search):
My Code:
var mySearch = search.create({
type: 'customrecord_configuration',
columns: ['custrecord_supervisor'],
filters: [
[
[
['custrecord_from_date', 'greaterthanorequalto', fromDate], 'AND', ['Formula Date', 'lesserthanoreqaulto', NVL2({
custrecord_end_date
}, {
custrecord_end_date
}, TO_DATE('01/01/2200', 'MM/DD/YYYY'))]
]
]
]
});
Thanks in Advance.
Upvotes: 1
Views: 2405
Reputation: 8847
The internal ID for a Formula (Date) column would be formuladate
, and your formula value needs to be a String:
[
'formuladate', 'lesserthanoreqaulto',
"NVL2({custrecord_end_date}, {custrecord_end_date}, TO_DATE('01/01/2200', 'MM/DD/YYYY'))"
]
If you use Chrome, you can also try this Chrome Extension that lets you export UI searches directly to code.
Upvotes: 3