Hello Gurus,
I'm trying to migrate the ClientScript SuiteScript 1.0 code to the ClientScript SuiteScript 2.0,which is getting data from the Suitelet, but when I'm running the SS2.0 versions of script I get the NetSuite login page, instead of the Suitelet response.
Here is the SuiteScript 1.0 which is working correctly and I have the Suitelet Response in the "pkt" variable:
var subsidID = nlapiGetFieldValue('subsidiary');var url = nlapiResolveURL('SUITELET','customscript_protogen','customdeploy_protogen',false);url+='&custparam_sid='+subsidID;var header = new Array();header['Content-Type'] = "text/xml; charset=utf-8";var reply = nlapiRequestURL(url,null,header);if(reply.getCode()==200){var pkt = reply.getBody();}Here is the same script in SuiteScript 2.0:
var subsidID = rec.getValue({fieldId: 'subsidiary'});var url = urlObj.resolveScript({scriptId: 'customscript_protogen',deploymentId: 'customdeploy_protogen'});url+='&custparam_sid='+subsidID;var headers = {'Content-type': 'text/xml; charset=utf-8'};var reply = http.get({url: url,headers: headers});if(reply.code==200){var pkt = reply.body;}the "pkt" variable has value:
<html> ↵ <head> ↵ <title>NetSuite Login</title> ↵ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> ↵ <link rel='stylesheet' href='/core/styles/pagestyles.nl?ct=-2&bglt=F2F4F6&bgmd=EDF1F7&bgdk=737A82&bgon=5C7499&bgoff=AFB5BF&bgbar=5C7499&tasktitletext=E4EAF4&crumbtext=C4C8CF&headertext=B5C1D5&ontab=FFFFFF&offtab=000000&text=000000&link=000000&bgbody=FFFFFF&bghead=FFFFFF&portlet=C0CAD9&portletlabel=000000&bgbutton=FFE599&bgrequiredfld=FFFFE5&font=Verdana%2CHelvetica%2Csans-serif&size_site_content=9pt&size_site_title=9pt&size=1.0&nlinputstyles=T&accessibility=F&appOnly=F&NS_VER=2020.1.0'> ↵ <link rel="stylesheet" href="/uirefresh/css/fonts.css"> ↵ <link rel="stylesheet" href="/uirefresh/css/global.css"> ↵ <link rel="stylesheet" href="/uirefresh/css/oneoff_loginpage.css?VER=2018.06.15"> ↵ <script type='text/javascript' src='/javascript/NLPortal.jsp?NS_VER=2020.1.0&minver=120&JSP_VER=1'></script> ↵ <script type='text/javascript' src='/authentication/ui/jquery/jquery-3.5.1.min.js?NS_VER=2020.1.0&minver=120'></script> ↵ <script type='text/javascript' src='/authentication/ui/jquery/jquery_isolation.js?NS_VER=2020.1.0&minver=120'></script> ↵ <script type='text/javascript' src='/javascript/NLUtil.jsp?NS_VER=2020.1.0&minver=120&JSP_VER=1'></script> ↵ <script type='text/javascript' src='/javascript/NLUtil.js?NS_VER=2020.1.0&minver=120'></script> ↵ <script type='text/javascript' src='/assets/help_service/2178999216.js?NS_VER=2020.1.0&minver=120'></script> ↵ <script type='text/javascript' src='/assets/legacy_apputil/1213801990.js?NS_VER=2020.1.0&minver=120'></script> ↵ <script type='text/javascript' src='/javascript/NLAppUtil.jsp?NS_VER=2020.1.0&minver=120&JSP_VER=1'></script> ↵ <script type='text/javascript' src='/assets/loginpage_defaultloginpage/3999100425.js?NS_VER=2020.1.0&minver=120'></script> ↵↵ </head> ↵ <body bgcolor="#FFFFFF" marginheight=5> ↵↵ <table width="100%" border="0" cellspacing="0" cellpadding="0"> ↵ <tr> ↵ <TD align='LEFT'> <TABLE cellpadding=0 cellspacing=0 border=0> <TR> <TD style="padding-top:1;"><a href='http://www.netsuite.com/portal/home.shtml' style='white-space:nowrap;'><img class='uir-logo' src='/images/logos/netsuite-oracle.svg' height='30' border=0 style='margin-right:30px;margin-left:20px;'></a></TD> <TD align='right'></TD> </TR> </TABLE> </TD> ↵ </tr> ↵ </table> ↵↵ <div class="header-separator"></div> ↵ <div id='div__alert' align='center'></div> ↵↵ <form method="post"> ↵ <input type="hidden" name="redirect" value="/app/site/hosting/scriptlet.nl?script=551&deploy=1&compid=TSTDRVXXXXXXX&custparam_sid=5">↵ <input type="hidden" name="c" value="TSTDRVXXXXXXX">↵ <table border="0" cellspacing="0" cellpadding="5" width="100%"> ↵ <tr class="content-row content-row-multiple"> ↵ <td class="page-message">↵Your session has timed out. Please log in again. </td> ↵ </tr> ↵ <tr> ↵ <td> ↵ <table border=0 cellpadding=5 cellspacing=0> ↵ <tr> ↵ <td class=smalltextnolink align=right>Email address</td> ↵ <td>↵ <input class="input" name="email" size="30" value="" maxlength="254">↵ </td> ↵ </tr> ↵ <tr> ↵ <td class=smalltextnolink align=right>Password</td> ↵ <td>↵ <input class="input" type="password" name="password" autocomplete="off" size="30" maxlength="254">↵ </td> ↵ </tr> ↵ <tr> ↵ <td class=text id="rememberMeLabel">↵ <input type="hidden" id="hintText" value="When you check this box, you will not have to re-enter your e-mail address when you log in. For security, you will always have to re-enter your password.">↵ <a id="remembermehint" class="smalltext" tabindex="-1" href="#">Remember Me</a>↵ </td> ↵ <td>↵ <input id="rememberme" name="rememberme" type="checkbox" value="" class="checkbox" />↵ </td> ↵ </tr> ↵ <tr> ↵ <td></td> ↵ <td><span id='tbl_Submit'><INPUT type='submit' class='bgbutton' style='' value='Log In' id='Submit' name='Submit'></span></td> ↵ </tr> ↵ </table> ↵ </td> ↵ </tr> ↵ <tr> ↵ <td class="privacy_statement_static">↵ By clicking on the Log In button, you understand and agree to <a href="https://www.oracle.com/us/legal/terms/index.html">Oracle Terms of Use</a> and <a href="https://www.oracle.com/us/legal/privacy/privacy-policy/index.html">Oracle Privacy Policy</a>↵ </td> ↵ </tr> ↵ <tr class="bottom-links"> ↵ <td class="smalltext">↵ <a href="/app/login/preparepwdreset.nl?email=">↵Forgot your password? </a>↵ </td> ↵ </tr> ↵↵ </table> ↵ </form> ↵↵↵ </body> ↵ </html> "
Can you help me ?
Thanks