RESTlet to get deleted records via saved search?
I need to get deleted records via RESTlet for intake into another system. I already have a RESTlet that works perfectly with saved searches (using nlapiSearchRecord). I naively expected to be able to create a saved search for deleted records and then call that from via RESTlet. However, that seems not possible, at least not with my current implementation. Relevant documentation says: When using the nlapiSearchRecord function to execute an existing saved search, note the following: Only saved searches on record types currently supported by SuiteScript can be executed.
Do a search on deleted records: https://system.na0.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2019_2/script/record/deletedrecord.html.
Standard scripted search advice applies: generate the search in the ui first and then script it. https://system.na0.netsuite.com/app/common/search/search.nl?searchtype=DeletedRecord&cu=T&e=F
If you don’t know how to script the search, this chrome plugin is generally recommended. https://chrome.google.com/webstore/detail/netsuite-search-export/gglbgdfbkaelbjpjkiepdmfaihdokglp
Thanks very much. I followed the steps you outlined. The plugin says that “Export as Script Not Supported”. If I use the plugin with another saved search, e.g., for “opportunity”, it successfully displays the search. So the plugin seems to be working.
I followed the explanatory link provided by the plugin’s error message: it’s the list of SuiteScript supported records.
https://netsuite.custhelp.com/app/answers/detail/a_id/10242
“deletedrecord” is not in that list.
This is consistent with my original understanding of the issue: deleted record search appears not to be supported by SuiteScript.
I know very little about NetSuite, so it’s likely I’m missing the obvious here. Any clarification would be appreciated.
Thanks again!
Looks like you won’t be getting help from the plugin then.
Deleted records is a supported record type, though its limited to search only. You can see the restriction on the suitescript record browser link. And you can see it in the list of search types from the N/search search type enumeration: https://system.na0.netsuite.com/app/help/helpcenter.nl?fid=section_4483165708.html
I see no reason why you cannot create the base search through the UI, save it, then load that search in a script, in your case the RESTlet.
You can dynamically add to the loaded search to fine tune it inline with your expectations at the time the RESTLet is called if need be.
(i.e. add columns / filters).