Common StandardLine and CustomLine Object Methods

The following object methods are referenced by both the StandardLine and CustomLine objects:

getAccountId()

Example

             function customizeGlImpact(record, standardLines, customLines, book)
   {
      ...
      var newLine = customLines.addNewLine();
      newLine.setCreditAmount(standardLines.getLine(0).getCreditAmount());
      newLine.setAccountId(standardLines.getLine(0).getAccountId());
      newLine.setMemo("Payment catches both revenue and cash.");
      ...
      var newLine = customLines.addNewLine();
      newLine.setDebitAmount(standardLines.getLine(1).getDebitAmount());
      newLine.setAccountId(standardLines.getLine(1).getAccountId());
      newLine.setMemo("Payment catches both revenue and cash.");
      ...
   } 

        

getClassId()

Example

             function customizeGlImpact(record, standardLines, customLines, book)
   {
      ...
      var context = nlapiGetContext();
      var makeClassesMandatory = context.getPreference('classmandatory');
      var allowPerLineClasses = context.getPreference('classesperline');
      ...
      var newLine = customLines.addNewLine();

      if (makeClassesMandatory || allowPerLineClasses)
      {
         // can also optionally set class
         newLine.setClassId(standardLines.getLine(0).getClassId());
      }
      ...
   } 

        

getCreditAmount()

Example

             function customizeGlImpact(record, standardLines, customLines, book)
   {
      ...
      var newLine = customLines.addNewLine();
      newLine.setCreditAmount(standardLines.getLine(0).getCreditAmount());
      newLine.setAccountId(standardLines.getLine(0).getAccountId());
      newLine.setMemo("Payment catches both revenue and cash.");
      ...
      var newLine = customLines.addNewLine();
      newLine.setDebitAmount(standardLines.getLine(1).getDebitAmount());
      newLine.setAccountId(standardLines.getLine(1).getAccountId());
      newLine.setMemo("Payment catches both revenue and cash.");
      ...
   } 

        

getDebitAmount()

Example

             function customizeGlImpact(record, standardLines, customLines, book)
   {
      ...
      var newLine = customLines.addNewLine();
      newLine.setCreditAmount(standardLines.getLine(0).getCreditAmount());
      newLine.setAccountId(standardLines.getLine(0).getAccountId());
      newLine.setMemo("Payment catches both revenue and cash.");
      ...
      var newLine = customLines.addNewLine();
      newLine.setDebitAmount(standardLines.getLine(1).getDebitAmount());
      newLine.setAccountId(standardLines.getLine(1).getAccountId());
      newLine.setMemo("Payment catches both revenue and cash.");
      ...
   } 

        

getDepartmentId()

Example

             function customizeGlImpact(record, standardLines, customLines, book)
   {
      ...
      var context = nlapiGetContext();
      var makeDepartmentsMandatory = context.getPreference('deptmandatory');
      var allowPerLineDepartments = context.getPreference('deptsperline');
      ...
      var newLine = customLines.addNewLine();

      if (makeDepartmentsMandatory || allowPerLineDepartments)
      {
         // can also optionally set department
         newLine.setDepartmentId(standardLines.getLine(0).getDepartmentId());
      }
      ...
   } 

        

getEntityId()

Example

          function customizeGlImpact(record, standardLines, customLines, book)
{
      var entityId = standardLines.getLine(1).getEntityId();
      var line = customLines.addNewLine()
      line.setAccountId(6)
      line.setDebitAmount(100)
      line.setEntityId(entityId)

      line = customLines.addNewLine()
      line.setAccountId(7)
      line.setCreditAmount(100)
} 

        

getLocationId()

Example

             function customizeGlImpact(record, standardLines, customLines, book)
   {
      ...
      var context = nlapiGetContext();
      var makeLocationsMandatory = context.getPreference('locmandatory');
      var allowPerLineLocations = context.getPreference('locsperline');
      ...
      var newLine = customLines.addNewLine();

      if (makeLocationsMandatory || allowPerLineLocations)
      {
         // can also optionally set location
         newLine.setLocationId(standardLines.getLine(0).getLocationId());
      }
      ...
   } 

        

getMemo()

Example

             function customizeGlImpact(record, standardLines, customLines, book)
   {
      ...
      var newLine = customLines.addNewLine();
      newLine.setCreditAmount(standardLines.getLine(0).getCreditAmount());
      newLine.setAccountId(standardLines.getLine(0).getAccountId());
      // append old memo to new memo text
      newLine.setMemo("Payment catches both revenue and cash. " + standardLines.getLine(0).getMemo());
      ...
      var newLine = customLines.addNewLine();
      newLine.setDebitAmount(standardLines.getLine(1).getDebitAmount());
      newLine.setAccountId(standardLines.getLine(1).getAccountId());
      // append old memo to new memo text
      newLine.setMemo("Payment catches both revenue and cash. " + standardLines.getLine(1).getMemo());

      ...
   } 

        

getSegmentValueId(segmentId)

Example

          function customizeGlImpact(transactionRecord, standardLines, customLines, book)
{
      ...
      for (var i = 0; i < standardLines.getCount(); i++)
      {
         var line = standardLines.getLine(i);

         var costCenterId = line.getSegmentValueId('csegcostcenter');
       var workCenterId = line.getSegmentValueId('csegworkcenter');

         ...
         // do something with the values
      }

      ...
      var newLine = customLines.addNewLine();
      // reading segment value from newly created line (value is null or copied from head)
      var costCenterId = newLine.getSegmentValueId('csegcostcenter');
      ...

      var newLine2 = customLines.addNewLine();
      ...
      newLine2.setSegmentValueId('csegcostcenter', getCostCenterValueForItem(itemId));
      if (newLine2.getSegmentValueId('csegcostcenter') == 1)
      {
         ...
      }
      ...
}
// Utility methods
function getCostCenterValueForItem(itemId)
{
      ...
      return valueId;
} 

        

Related Topics

customizeGlImpact(transactionRecord, standardLines, customLines, book)
CustomLines
StandardLines

General Notices