CustomLine

isBookSpecific()

Example

             function customizeGlImpact(transactionRecord, standardLines, customLines, book)
   {
      ...
      if(book.isPrimary())
      {
         // set all custom lines to apply to all books
         for (var i = 0; i < customLines.getCount(); i++) 
         {
            var currLine = customLines.getLine(i);
            if (currline.isBookSpecific()) 
            {
               currLine.setBookSpecific(false);
               ...
            }
         }
      }
      ...
   } 

        

setBookSpecific(bookSpecific)

Example

             function customizeGlImpact(transactionRecord, standardLines, customLines, book)
   {
      ...
      if (book.isPrimary()) 
      {
         // set all custom lines to be specific to the primary book
         for (var i = 0; i < customLines.getCount(); i++) 
         {
            var currLine = customLines.getLine(i);
            if (!currline.isBookSpecific()) 
            {
               currLine.setBookSpecific(true);
               ...
            }
         }
      }
      ...
   } 

        

setAccountId(accountId)

Example

             function customizeGlImpact(transactionRecord, 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.");
      ...
   } 

        

setClassId(classId)

Example

             function customizeGlImpact(transactionRecord, standardLines, customLines, book)
   {
      var context = nlapiGetContext();
      var makeClassesMandatory = context.getPreference('classmandatory');
      var allowPerLineClasses = context.getPreference('classesperline');
      ...
      var newLine = customLines.addNewLine();
      ...
      if (makeClassesMandatory || allowPerLineClasses)
      {
         var classId = getClassForItem(itemId);
         newLine.setClassId(classId);
      }
      ...
   }
   
   // Utility methods
   function getClassForItem(itemId)
   {
      ...
      return classId;
   } 

        

setCreditAmount(credit)

Example

             function customizeGlImpact(transactionRecord, 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.");
      ...
   } 

        

setDebitAmount(debit)

Example

             function customizeGlImpact(transactionRecord, 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.");
      ...
   } 

        

setDepartmentId(departmentId)

Example

             function customizeGlImpact(transactionRecord, standardLines, customLines, book)
   {
      var context = nlapiGetContext();
      var makeDepartmentsMandatory = context.getPreference('deptmandatory');
      var allowPerLineDepartments = context.getPreference('deptsperline');
      ...
      var newLine = customLines.addNewLine();
      ...
      if (makeDepartmentsMandatory || allowPerLineDepartments)
      {
         var departmentId = getDepartmentForItem(itemId);
         newLine.setDepartmentId(departmentId);
      }
      ...
   }
   
      // Utility methods
   function getDepartmentForItem(itemId)
   {
      ...
      return departmentId;
   } 

        

setEntityId(entityId)

Function Declaration

void setEntityId(int entityId)

Type

Object method

Description

Sets the entity ID property for a CustomLine object in a primary or secondary book to the internal NetSuite ID

Supported entity types include:

  • Customers

  • Jobs

  • Leads

  • Prospects

  • Vendors

  • Employees

  • Other Names

The following restrictions apply to setting of entities on custom GL lines:

  • Setting of a vendor is not supported on lines with an Accounts Payable account type.

  • Setting of a customer is not supported on lines with an Accounts Receivable account type.

  • Creating book-specific custom GL lines with an AP or AR account and entity combination. Only generic custom GL lines can be created with this combination.

  • Only entities that have the same subsidiary as a transaction can be set on lines for that transaction.

  • Only entities that have the same currency as a transaction can be set on lines for that transaction.

  • Entities must be active

Note:

This method does not set the sales representative for the line, and it does not change the date of the first sale for the customer.

Returns

void

Input Parameters

entityId {int} — internal NetSuite ID for an entity

Parent object

CustomLine

Example

          function customizeGlImpact(record, standardLines, customLines, book)
{
      var line = customLines.addNewLine()
      line.setAccountId(6)
      line.setDebitAmount(100)
      line.setEntityId(99)

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

        

Reports that include GL information and are grouped by entity include custom GL information, if the entity is supported by the new method.

A GL Impact example showing custom GL information included.

setLocationId(locationId)

Example

          function customizeGlImpact(transactionRecord, standardLines, customLines, book)
   {
      var context = nlapiGetContext();
      var makeLocationsMandatory = context.getPreference('locmandatory');
      var allowPerLineLocations = context.getPreference('locsperline');
      ...
      var newLine = customLines.addNewLine();
      ...
      if (makeLocationsMandatory || allowPerLineLocations)
      {
         var locationId = getLocationForItem(itemId);
         newLine.setLocationId(locationId);
      }
      ...
   }
   
   // Utility methods
   function getLocationForItem(itemId)
   {
      ...
      return locationId;
   } 

        

setMemo(memo)

Example

             function customizeGlImpact(transactionRecord, 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.");
      ...
   } 

        

setSegmentValueId(segmentId, segmentValueId)

Example

          function customizeGlImpact(transactionRecord, standardLines, customLines, book)
{
    ...
    var newLine = customLines.addNewLine();
    ...
    // custom function for getting value for cost center segment
    newLine.setSegmentValueId('csegcostcenter', getCostCenterValueForItem(itemId));
    // using constant for region segment
    newLine.setSegmentValueId('csegregion', 3);
    // copying segment value from line 0 for work center segment
    var workcenter = 'csegworkcenter'
    newLine.setSegmentValueId(workcenter, standardLines.getLine(0).getSegmentValueId(workcenter));
    ...
}
// Utility methods
function getCostCenterValueForItem(itemId)
{
    ...
    return valueId;
} 

        

Related Topics

customizeGlImpact(transactionRecord, standardLines, customLines, book)
CustomLines

General Notices