Does anyone know if scheduled scripts have access ...
# suitescript
w
Does anyone know if scheduled scripts have access to special searches that wouldn't be listed in the Saved Searches list? I have a scheduled script that relies on the results of
nlapiLoadSearch('transaction', 'customsearch_tracking_numbers_to_track')
, but I can't find that saved search anywhere. When I try to run the scheduled script in the debugger it can't seem to find it either.
c
Does the code work when the script runs in the same environment you're using the debugger?
Looks like the search might be private and maybe doesn't exist in the environment you're running the debugger?
w
I haven't tried running the script in the same environment as the debugger. Would that just be running it in
<https://debugger.na0.netsuite.com/>
?
I can't see the search in the regular environment where it normally runs either though, so that's why I'm at a loss.
m
If you have the internal ID of the search you're trying to find, you can edit a different search and replace the internal ID in the URL of the search you want to see. I've seen situations where Admins can't see the private searches created by other Admins.
w
The only id I have is
custscript_connect_to_live_server
unfortunately. That's how it's being used in the scheduled script.
That gives me an idea though. I'm going to add some debug code to log the internalId by calling
getId()
on the
nlobjSearch
in the scheduled script.
e
is the scheduled script executing under a specific user? and only works for that user?
w
"Execute as Role" is set to Administrator, but I'm logged in as an Admin and can't see the search.
I was finally able to find the saved search that way. It was not set to
public
, which is why it wouldn't show up in the saved search list. Thanks @Mike Robbins for the idea.