here is a snippet of what my Suitelet is trying to...
# suitescript
b
here is a snippet of what my Suitelet is trying to do.
Copy code
var userId = nlapiGetUser();
    nlapiLogExecution('DEBUG', 'user is:', userId);
    if (userId < 1) {
      var context = nlapiGetContext();
      var userAccountId = context.getCompany();

      url = '/c.' + userAccountId + '/sspapplicationname/checkout.ssp';
    } else {
      url = nlapiOutboundSSO('customsso_sso_pieslak_test');
    }
s
that should log your DEBUG statement no matter how it's invoked... are you using the 'internal' or the 'external' url to hit the suitelet? Using the 'external' url in your browser should result in that message being displayed, provided the code snippet above is run for an HTTP GET request
b
I'm using the external url, but with 1 slight difference. instead of using the "forms.netsuite.com" domain I am using "checkout.netsuite.com"
s
does it work with
forms
but not with
checkout
?
b
what I'm seeing is when I use the External Url: https://forms.netsuite.com/app/site/hosting/scriptlet.nl?script=...&amp;deploy=1&amp;compid=...&amp;h=... the suitelet executes, but it cannot resolve the current user's identity, even if they are logged in to the SSP application.
s
use the internal url when users are logged in
b
when I change the domain name and us a url of: https://checkout.netsuite.com/app/site/hosting/scriptlet.nl?script=...&amp;deploy=1&amp;compid=...&amp;h=... the suitelet executes correctly when I am logged in. when I am not logged in, however, I am redirected here: https://system.netsuite.com/app/login/secure/enterpriselogin.nl?c=...&amp;whence=
the "internal url" doesn't work for me with Customer Center users, unfortunately.
I think I need to add a page to my ssp application that handles my authentication status check.
s
it does all come down to the (login) cookie and which domains it will attach to
b
understood - and that makes sense. what I can't figure out is why NetSuite won't serve my Suitelet to "checkout.netsuite.com" when I'm not authenticated. Probably b/c that is my checkout domain.
the ssp application code knows, simply by the header for showing "Login | Register" vs "Welcome Brian!" - but that gets into SuiteCommerce land.
I think I have a solution that will work, it just requires more code in SuiteCommerce than I originally expected
if NetSuite would serve my suitelet over "checkout.netsuite.com" when a user is not authenticated, that would be ideal.
@stalbert - thank you very much for the assistance
s
sorry, you may have to change the domain dynamically based on whether the user is logged in or not?
another thing you might try is using the domain name you have registered (if any) for the sitebuilder site
b
yes - I think that approach will work. I'm using SCA instead of SiteBuilder.