I have a saved search for messages including the c...
# suitescript
m
I have a saved search for messages including the casenumber, it returns results in netsuite but not when I run it in suitescript 2.0 with no filters added. Why would that be?
b
you can try sharing the code
but in general the answer is permission issues or classification issue
m
Wouldn't it throw a permission error then, and the user authenticated in the restlet created and can view the search in NetSuite too. Here is the code that runs the search in the restlet.
function searchMessages(caseNumber){ try{ var mySearch = search.load({ id: 'customsearch_messages' }); // var caseFilter = search.createFilter({"name" : "casenumber", "operator" : "is", "values" : caseNumber }); // var messageFilter = search.createFilter({"name" : "internalonly", "operator" : "is", "values" : false }); // mySearch.filters.push(caseFilter); // mySearch.filters.push(messageFilter); var resultset = mySearch.run(); return resultset.getRange(0, 100); }catch(error){ log.error({ title: 'searchCaseByNumber error', details: JSON.stringify(error) }); return JSON.stringify(error); } }
b
If the user can login with the role used in the restlet and see search results then it is unlikely to be permission or classification related
That said, you would only get an error if the role couldnt access any messages. You would not get an error if the role could access some but not all.
m
This doesn't make much sense. I can run a search for a support case with adding message fields, even though those fields don't match some of the message values shown in NetSuite. That's why I want to run a straight search on the messages themselves.. Thanks for trying..
Think I was wrong, I was logged i as that user but on on a different role as the token is authenticated with.