title: Netsuite: How to pass variable from client script to suitelet?
body: <p>I am just a fresh beginner so forgive me for any silly mistake.</p>
  <p>I have two codes, one for the client script page init and the other is for suitlet script. What I am trying to do is a form and a sublist on a suitelet script, then pass exisiting record fields to the sublist form using a client script getValue function.</p>
  <p>Is this possible? and how?</p>
  <p>Here is my main code:
  (payrollf is a saved search function for the sublist)</p>
  <pre><code>/**
   * @NApiVersion 2.x
   * @NScriptType Suitelet
   * @NModuleScope SameAccount
   */
  define(['N/log', 'N/record','N/search', 'N/ui/serverWidget'],
  /**
   * @param {log} log
   * @param {search} search
   * @param {serverWidget} serverWidget
   * @param {record} record
   */
  function(log, record, search, serverWidget) {
     
      /**
       * Definition of the Suitelet script trigger point.
       *
       * @param {Object} context
       * @param {ServerRequest} context.request - Encapsulation of the incoming request
       * @param {ServerResponse} context.response - Encapsulation of the Suitelet response
       * @Since 2015.2
       */
      function onRequest(context) {
          var request=context.request;
          var response=context.response;
          var form=serverWidget.createForm({
              title:'Payroll Initiation'
          });
          var sublist = form.addSublist({
              id: 'custpage_payrollsublist',
              type: serverWidget.SublistType.LIST,
              label: 'Payroll Sublist'
          });
          
              var payrollf=payroll();
              sublist.addField({
                  id: 'custpage_amnt',
                  label: 'Amount',
                  type: serverWidget.FieldType.TEXT
              })
  
              sublist.addField({
                  id: 'custpage_date1',
                  label: 'Effective From',
                  type: serverWidget.FieldType.DATE
              })
               sublist.addField({
                 id: 'custpage_rate',
                 label: 'Rate',
                 type: serverWidget.FieldType.TEXT
             })
  
             sublist.addField({
                 id: 'custpage_date2',
                 label: 'Effective Through',
                 type: serverWidget.FieldType.DATE
             })
           var path= form.clientScriptModulePath='SuiteScripts/ClientSuitlet.js';
  
              payrollf.run().each(function(){
                 var counter=0;
                 sublist.setSublistValue({
                     id: 'custpage_amnt',
                     line: counter,
                     value: path.Amount,
                   
                 });
                 
                 sublist.setSublistValue({
                     id: 'custpage_rate',
                     line: counter,
                     value: Rate,
                     
                 });
                 sublist.setSublistValue({
                     id: 'custpage_date1',
                     line: counter,
                     value: date1,
                     
                 });
                 sublist.setSublistValue({
                     id: 'custpage_date2',
                     line: counter,
                     value: date2,
                     
                 });
                 
          counter++;
          return true;
          });
          
               
                  response.writePage(form);   
                  
                  
               
          
      }
  
  
  Client Script code on page initialization:
  
   function pageInit(context) {
          var currRecord=context.currentRecord;
          var Amount=currRecord.getValue('amnt');
          var Rate=currRecord.getValue('rate');
          var date1=currRecord.getValue('date1');
          var date2=currRecord.getValue('date2');
      }
  </code></pre>