Has anyone tried posting from a 1.0 Suitelet to a ...
# suitescript
n
Has anyone tried posting from a 1.0 Suitelet to a 2.0 Suitelet?
a
not personally but no reason it shouldn't work... suitelet entry point is just a network call, it doesn't care about the source
n
@Anthony OConnor i tried this but nothing ever logs on my 2.0 SL. var response = nlapiRequestURL('https://tstdrv12345.app.netsuite.com/' + suiteletUrl, JSON.stringify(oRequestData), oHeaders, 'POST');
n
Try using the available without login URL.
Also, try with the header : User-Agent : Mozilla/5.0
n
This is the error I see on the 1.0 SL, and still nothing on 2.1 SL
Copy code
TypeError: Cannot find function writePage in object nlobjServerResponse. (Inscio - Suitelet - RA Availability.js$22979#639); ID: meiq00z3togmi5hgdnek
n
Share the code.
n
Copy code
var oHeaders = {
                    'Content-type': 'application/json'
                };
                var oRequestData = {
                    param1: 'value1',
                    param2: 'value2'
                };

                var theurl = '<https://tstdrv2309831.extforms.netsuite.com/app/site/hosting/scriptlet.nl?script=1636&deploy=1&compid=TSTDRV2309831&ns-at=AAEJ7tMQx7dSAxiVvDfTa-frEuCK5MpC0pYQC_l-1BNdrHRQ5EA>'
                
                var response = nlapiRequestURL(theurl, JSON.stringify(oRequestData), oHeaders, 'POST');
in 2.1 im logging here: function onRequest(context) { const request = context.request; const response = context.response; log.error({title : 'request', details: JSON.stringify(request)});
n
Where is the .writePage part?
n
okay fixed that error. But no log in 2.1 script: var oHeaders = { 'Content-type': 'application/json' }; var oRequestData = { param1: 'value1', param2: 'value2' }; var theurl = 'https://tstdrv2309831.extforms.netsuite.com/app/site/hosting/scriptlet.nl?script=1636&amp;deploy=1&amp;compid=TSTDRV2309831&amp;ns-at=AAEJ7tMQx7dSAxiVvDfTa-frEuCK5MpC0pYQC_l-1BNdrHRQ5EA' var responsefromothersl = nlapiRequestURL(theurl, JSON.stringify(oRequestData), oHeaders, 'POST'); var form = nlapiCreateForm('Rental Agreement Suitelet'); form.setScript('customscript_dc_client_rental_avail'); response.writePage(form);
n
Try it now. Previously, you were using response variable for the nlapiRequestURL response as well. var response = nlapiRequestURL(theurl, JSON.stringify(oRequestData), oHeaders, 'POST');
n
yeah, that is what I realized.
n
Does it work?
n
500 error
n
Try the standard URL.
and try with the header
n
same no logs on other end and 500 error
n
Try to hit your other SL from POSTman to make sure there are no problems.
1