Posts

Showing posts from May, 2018

USER EVENT SCRIPT 2.0 TO LOAD A RECORD, READ IT'S VALUE AND SET A FIELD VALUE

Feel free to reach your  NetSuite Solution Provider  , TheSmilingCoders for proper  netsuite implementation ,  netsuite consultation  ,  netsuite customization ,  netsuite Support , netsuite Training,  contact us at: Email : info@smilingcoders.com Below code loads a sales order, reads it's sublist values and sets value of a custom field. Email : info@smilingcoders.com /**  *@NApiVersion 2.x  *@NScriptType UserEventScript  */ define(['N/record','N/log'], // modules used     function(record,log) {             function afterSubmit(context) {             if (context.type !== context.UserEventType.DELETE)             {                                  var rec_id = context.newRecord.id; // get record id                                          log.debug({                       title: 'rec_id',                       details: rec_id                       });                                          var load_so =  record.load(

HOW TO CREATE A FULL CALENDAR IN NETSUITE USING SUITELET?

A full calendar can be built in netsuite using suitelet script. This would require you to first download the zip file from https://fullcalendar.io/download. Feel free to reach your  NetSuite Solution Provider  , TheSmilingCoders for proper  netsuite implementation ,  netsuite consultation  ,  netsuite customization ,  netsuite Support , netsuite Training,  contact us at: Email : info@smilingcoders.com Place this file at file cabinet and note down the url of fullcalendar.min.css, fullcalendar.print.min.css, /lib/moment.min.js, /lib/jquery.min.js, fullcalendar.min.js. You can also create a client script and refer that url in html link ref, so that it can be triggered when user selects a date. Below is the sample code: replcae the link url with your url  var html = '<!DOCTYPE html>\n' +'<html>\n' +'<head>\n' +'<meta charset="utf-8" />\n' +'<link href="https://system.netsuite.com/co

HOW TO CREATE SUITELET ASSISTANT IN NETSUITE?

Creating a suitelet assistant involves the following steps: Feel free to reach your   NetSuite Solution Provider   , TheSmilingCoders for proper   netsuite implementation ,  netsuite consultation  ,  netsuite customization ,  netsuite Support , netsuite Training,  contact us at: Email : info@smilingcoders.com 1)  Create the assistant. 2)  Create steps. 3) Attach client script to validate data on page init, field change, save ( when user clicks on next or finish) or any other trigger function supported by client script. 4)  Build pages for each step. (Get Function) 5) Set values for fields 6) Set up the action when user clicks on next, cancel, back or finish. (Post function) 1) Create the assistant First step is to create assistant by using the api. You can provide name of the assistant under the api parameter. var assist = nlapiCreateAssistant('SUITELET ASSISTANT); 2)  Create steps. Second step is to assign steps to the assistant. You must provide internal id and t

PROCURE TO PAY FLOW IN NETSUITE- NETSUITE ACADEMY

Procure to Pay involves the following steps in Netsuite 1) Create Purchase Order. 2) Approve Purchase order. 3) Create Item Receipt. 4) Create Vendor bill. 5) Create Vendor Payment. Feel free to reach your  NetSuite Solution Provider  , TheSmilingCoders for proper  netsuite implementation ,  netsuite consultation  ,  netsuite customization ,  netsuite Support , netsuite Training,  contact us at: Email : info@smilingcoders.com

ORDER TO CASH FLOW IN NETSUITE - NETSUITE ACADEMY

Order to Cash flow in Netsuite involves the following: 1) Create Sales Order 2) Approve Sales Order 3) Create Fulfilment record for the sales order. This involves pick, pack and ship 4) Create Invoice 5) Create Customer Payment record. Feel free to reach your  NetSuite Solution Provider  , TheSmilingCoders for proper  netsuite implementation ,  netsuite consultation  ,  netsuite customization ,  netsuite Support , netsuite Training,  contact us at: Email : info@smilingcoders.com

WHY CLIENT SCRIPT DOESN'T EXECUTE SOMETIMES IN NETSUITE? - NETSUITE ACADEMY

Client script sometimes executes using old code and not the updated code. To resolve this, cache needs to be cleared. Cache can be cleared Once cache is cleared from the browser, you can login to the account again and execute the code. Now, the latest version of the code will get executed. -Netsuite Academy Feel free to reach your   netsuite Training  ,   NetSuite Solution Provider  , TheSmilingCoders for proper  netsuite implementation ,  netsuite consultation  ,  netsuite customization ,  netsuite Support ,

USING CASE (IF AND ELSE) IN NETSUITE SAVED SEARCH- NETSUITE ACADEMY

While creating a saved search in Netsuite, you want encounter a situation where you want have to display a value depending on some conditions. Such scenarios can be implemented by using sql CASE syntax in the formula field. For eg, in a transaction search, if you want to display a value depending on the transaction type, then you can add a formula text field in coulmn and use CASE as given below: CASE WHEN {type}='Invoice' THEN '0' WHEN {type}='Journal' THEN {status}  ELSE '' END The above field will display 0 when type is Invoice. It will display status of the transaction when type is Journal and for other transaction type, it will be blank. NETSUITE ACADEMY Feel free to reach out TheSmilingCoders for proper  netsuite implementation ,  netsuite consultation  ,  netsuite customization ,  netsuite Support , netsuite Training    contact us at: Email : info@smilingcoders.com Facebook :  https://www.facebook.com/Smiling-Coders-Netsuite-Tra

Work Around the 1000 Row Limit Returned by Saved Searches in Netsuite

nlapiSearchRecord can return only upto 1000 rows. But there is a work around to retrieve more than 1000 rows. This can be done by first sorting the result based on internal id and then using while loop and use concat method to get all results by internalid number as a filter inside the while loop. The sample code is given below: var filters = new Array(); filters[1] = new nlobjSearchFilter('mainline',null,'is','T'); var columns = new Array(); columns[0] = new nlobjSearchColumn('internalid').setSort();  //sort the result based on internalid var results = nlapiSearchRecord('transaction',null,filters,columns);  //search record var completeResultSet = results;  //copy the result while(results.length == 1000){  //if there are more than 1000 records      var lastId = results[999].getValue('internalid');  //note the last record retrieved      filters[2] = new nlobjSearchFilter('internalidnumber',null,'greaterthan',lastId);  //cre

Resolve Netsuite Scripting Error "Cannot read property "length" from null"

One of the common errors while searching a record using script is  "Cannot read property length from null". This error occurs when you try to get length of search record object which returns a null value. Length method can be used only if search record API returns some value. If it returns null, then length method should not be used. For eg. below code will return a error if search record gives no result- var results = nlapiSearchRecord('salesorder', null, filters, columns);  nlapiLogExecution('DEBUG', 'search results', results.length); To remove this error add a condition to check if result is null or not var results = nlapiSearchRecord('salesorder', null, filters, columns); if(results!=null) {       nlapiLogExecution('DEBUG', 'search results', results.length); } Feel free to reach out TheSmilingCoders for proper  netsuite implementation ,  netsuite consultation  ,  netsuite customization ,  netsuite Support

HOW TO GET THE TYPE PARAMETER OR RECORD ACCESS MODE IN CLIENT SCRIPT SAVE EVENT?

The Save Record event on a Client-side script does not have the ability to determine the value of the 'type' parameter or Access Mode (create, copy, edit) of a record unlike the Page Init event. The alternative is to make use of a global variable that stores the type from page init function and can then be accessed from save function. var access_mode = ''; // global variable function clientPageInitl(type){ access_mode = type; // to read it in before submit     } function clientSaveRecord(){  alert('access mode = '+access_mode);             } Feel free to reach out TheSmilingCoders for proper  netsuite implementation ,  netsuite consultation  ,  netsuite customization ,  netsuite Support , netsuite Training   netsuite solution provider contact us at: Email : info@smilingcoders.com Facebook :  https://www.facebook.com/Smiling-Coders-Netsuite-Training-Implementation-and-Support-1591053827660082/ Linkedin :  https://www.linke

SCRIPT TO ENCRYPT A FILE IN NETSUITE

HOW TO ENCRYPT A FILE IN NETSUITE USING SCRIPT? - NETSUITE ACADEMY Netsuite scripting provides the ability to encrypt any file stored in file cabinet. You would need the file id for this purpose. This file id can be hard coded or obtained using search as per the requirement. The default algorithm used for encrypting is  SHA-1 method. The other available methods are  base64,  aes,  xor. The below code shows how to encrypt a file using  Advanced Encryption Standard (AES) method. {                   var loadfile = nlapiLoadFile(fileid);  // can be used only in server side script           var filevalue = loadfile.getValue();          var encrypted_text = nlapiEncrypt(filevalue, "aes");                         var filename = loadfile.getName()+'_encrypted';                             nlapiLogExecution('DEBUG', 'filename', filename);                              var file_folderid = loadfile.getFolder();                           

HOW TO CREATE A FUNCTIONALITY TO PRINT GL IMPACT OF A TRANSACTION IN NETSUITE?

Netsuite provides the functionality to print a transaction but there is no standard functionality to print GL impact of a transaction. To create a new functionality to print GL impact of a transaction, we can make use of scripts. Using user event script, we can create a custom button on transaction. On click of this button a client script will get triggered which will open a suitelet to print the transaction. The code below shows how to create a custom code to print GL impact of an item fulfillment record. 1. First create a client script. This need not be deployed. Note down the script id. Let us assume that script id is "customscript_client_call_suitlet_printgl". 2. Write a User Event script to add a custom button on item fulfillment. Attach the client script created above to trigger it on click of button. function userEventBeforeLoad(type, form, request){ if(type=='view') {          form.setScript('customscript_client_call_suitlet_printgl&