Is it possible to call a Suitelet that is not avai...
# suitescript
d
Is it possible to call a Suitelet that is not available without login from a RESTlet?
👍 1
a
Yes someone please answer this question
b
not without doing something that logs into netsuite
d
@battk Is the token for the RESTlet not enough?
b
no
that information is not available to the restlet, nor is it enough
d
Interesting. Do you know of any way to securely call a suitelet externally without making it available without login then?
b
recommended workaround is to use the code for the suitelet in the restlet
that is usually made easier by writing the shared logic in a custom module
d
so does the redirect.toSuitelet() method not preserve the login?
we have a super extreme SS1.0 suitelet from a past dev we need to call from an external system
b
redirects are for people logged into netsuite
that said, while its not supported for restlets, i havent tried N/redirect from a restlet to confirm
z
i’ve had success making CORS requests from the client - that only works if you are logged in when you make the request though
d
We are trying to do this through web services, on a token user.
No UI access can happen
b
i vote write your restlet in suitescript 1 and then use the code for the suitelet as a library file
d
@battk Noted and certainly valid. This might sound crazy... Restlet > Scheduled > User event > Suitelet?
This suitlet we are discussing is no joke. Massive with multiple massive library files
b
i dont see how the user event script has an easier time with the suitelet than the restlet
d
I am not super experienced with suitelets, i just know we have other UEs that call them
but if it's 100% dependent on a UI login then we are gonna have to go your way
b
internal urls normally require a cookie for access
server side scripts dont have that cookie
d
that is a very helpful piece of info
a
client script can call suitelet and return data from suitelet back into client context. can we do restlet>client>suitelet?
b
if you are insane, some user event scripts can call internal urls because the user who triggered it has the cookie
client scripts work because they are run by the user's computer, who have the cookie
🤘 1
a
we are going to try this
b
you should have difficulty getting a client script to run from a restlet
a
oh yeah didn't think that through lol
I know ue is servierside and can call client script via button so my logic was maybe restlet can call client
b
There is a high maintenance technique that you can try. I only found it in one place in SuiteAnswers, and its basically equivalent to logging into NetSuite
Ignore the task that it is trying to accomplish and pay attention to how it accomplishes it
a
have you personally tried this?
b
its not very difficult to try yourself
i personally dont like using things that rely on behavior not described in help documents.
d
i like the idea of making a 1.0 restlet with all the suitelet code, but then we have double code to maintain
b
its the same code, you just call the suitelet entry point function with an object that mocks the request and response parameters
a
I don't like the idea of putting login credentials hardcoded in ther script
b
thats the reason i call it high maintenance
you can make it slightly better by using a credential field, but its still a pretty bad solution in my opinion