Created
October 19, 2021 07:42
-
-
Save axilaris/70a24cd73b76f3d6b6bbd0f8681518eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @NApiVersion 2.1 | |
| * @NScriptType Restlet | |
| */ | |
| define([ | |
| "N/log", | |
| "N/search", | |
| ], function (log, search) { | |
| function post(context) { | |
| log.debug('POST1 Context', context); | |
| return JSON.stringify(getCustomRecords(context)); | |
| } | |
| function getCustomRecords(context) { | |
| var mycustomSearch = search.create({ | |
| type: search.Type.CUSTOM_RECORD + '1589', | |
| title: 'Search Title', | |
| id: 'customsearch_my_second_so_search', | |
| columns: [{ | |
| name: 'id' | |
| }, { | |
| name: 'custrecord3987' | |
| }], | |
| filters: [{ | |
| name: 'custrecord3987', | |
| operator: search.Operator.EQUALTO, | |
| values: [context.custrecord3987] | |
| }], | |
| }); | |
| return mycustomSearch; | |
| } | |
| return { | |
| post: post, | |
| }; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| payload = { | |
| "custrecord3987": "12345678", | |
| } | |
| ... |
@axilaris
Just from experience! Some times you can just try them until one works, usually IS, EQUALTO or ANYOF if it's one thing equaling another thing.
Another thing that you can do, you can build the Saved Search inside NetSuite using the UI, add the columns and filters as well. Then use this chrome extension:
https://chrome.google.com/webstore/detail/netsuite-search-export/gglbgdfbkaelbjpjkiepdmfaihdokglp
And it will turn that search into suitescript 2.0 code that you can paste into your script. Then you won't even need to think about the syntax of the columns/filters.
Hope this helps!
Another great chrome extension: https://chrome.google.com/webstore/detail/netsuite-field-explorer/cekalaapeajnlhphgdpmngmollojdfnd
Thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@naschumer thank you so much, it worked! really really appreciate it.
Out of curiousity, how do you know which operator to use for the types, I'd like to know.