Anyway to know it is stored in savedsearch or not

不羁的心 提交于 2019-12-13 02:08:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!