Hello Everyone, I am trying to do the following, -...
# suitescript
a
Hello Everyone, I am trying to do the following, - Load a saved search - Set its filters - Save the search record - Execute it. But, after I save my search record it is getting saved as a private saved search and hence I am getting the following error 'That search or mass update does not exist'. Note: I have used the setIsPublic(true) method to make the search public while saving it. Following is my code snipet: var searchRecordData = nlapiLoadSearch(recType, dataSSID); searchRecordData.setFilters([ new nlobjSearchFilter(columnId, null, 'IS', id) ]); searchRecordData.setIsPublic(true); searchRecordData.saveSearch(); var resultSet = searchRecordData.runSearch(); Script version: suitescript 1.0 it is a '.ss' file being run with elevated permissions. Thanks in advance!
n
@Abhishek Dev Do you need to save it? If not just load it, update it, execute it.
a
I tried setting filters and executing it without saving but the filters didn't apply in this case.
n
I suspect you're not adding your filters correctly,
a
So, when I save the search record, the filters which I am setting are visible on the search record. If I don't save then they won't show.
n
I'm not sure you set it to public like that in script. If it's SS1.0 you set booleans as "T" or "F". However, why not set it to public via the UI before you start working on it?
a
I have set it to public before executing my code, from the UI. Once I save the search record from my code (after setting the filters) it is getting saved as a private search record. I tried setIsPublic('T') but it gave me an error: 'Can't find method com.sun.proxy.$Proxy501.setIsPublic(string)'
n
yeah, sorry you're correct I haven't written SS1.0 in an age and just found an old script with that exact thing: .setIsPublic(true);, not sure then mate I'm afraid.
@Abhishek Dev ah, just one thing, maybe try saving it as a new saved search, give it a new id, it may be you are not able to overwrite that value.
a
Thanks @NElliott but that option isn't viable for me. Thanks anyways..
b
might be permission related
try running it as administrator