简体   繁体   中英

How to create an search using the Filter Condition as an Formula Date Field with NVAL2 Function in SuiteScript 2.0 version

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):

使用带有NVAL2功能的公式日期字段的过滤条件

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM