Tuesday, September 25, 2018

Create Logs for Scripts Used in Scriptable Checkout

When using scriptable checkout, the Standard Online Order - Invoice or the Standard Online Order - Cash Sale form must be customized by attaching a script. The script does not normally log. To work around this limitation, create a Suitelet that will perform the logging. Call this Suitelet from the script applied to the Transaction form used in Scriptable Checkout.

Suitelet Code:

Note: Set the deployment as "Execute as Admin = Yes" and "Available Without Login = Yes"

function Suitelet_Log(request, response)
{
   nlapiLogExecution('DEBUG', 'Web Store', unescape(request.getParameter('custpage_log')));
}

Scriptable Checkout (client) Script
var log = function(s){
   nlapiRequestURL('https://forms.netsuite.com/app/site/hosting/scriptlet.nl? script=176&deploy=1&compid=TSTDRV594049&h=acf270424f11a4e8f334'+'&custpage_log='+ escape(s));
   //This would be the External URL of the Suitelet
}

function webfieldChanged(type, name, linenum) {
   var tot = parseFloat(nlapiGetFieldValue('total') || 0);
   log("Total Amount: "+tot);
}

No comments:

Post a Comment