问题
I'd like to search using savedsearch.
Here my code snippet goes.
var searchresults = nlapiSearchRecord('item', search_id, null, null);
search_id
is defined as parameter in text field.
This is suitelet
script so if you couldn't find similar search_id
in savedsearch
then it throws exception.
To avoid this I'd like to check if there is any similar internal id in saved searches.
For instance if there are two saved searches which ids are customsearch1
, customsearch2
.
If search_id
is 'cust'
then it throws exception and script finished with error.
It shows this in script log
'That search or mass update does not exist.'
Looking forward to hearing from you soon. Regard
回答1:
You can do a saved search of saved searches. You could take the results and use regex to determine if there is a similiar one. Use trim plus regex.
回答2:
You could prevent this by changing your search_id parameter to a List/Record of Saved Searches.
Any reason why it has to be a text field?
来源:https://stackoverflow.com/questions/36213632/anyway-to-know-it-is-stored-in-savedsearch-or-not