Common StandardLine and CustomLine Object Methods
The following object methods are referenced by both the StandardLine and CustomLine objects:
getAccountId()
Function Declaration |
|
Type |
Object method |
Description |
Returns the internal NetSuite account ID for a StandardLine or CustomLine object. This account ID represents the NetSuite general ledger account to which a credit or debit is applied on the GL impact for a transaction. Use this ID to define plug-in implementation functionality based on the credited or debited account. See also setAccountId(accountId). You can view the internal NetSuite ID for all accounts on the Chart of Accounts page at Setup > Accounting > Chart of Accounts. You can use helper functions in a utility file to avoid adding the internal NetSuite IDs into the plug-in implementation logic. See Utility Files for a Custom GL Lines Plug-In Implementation. |
Returns |
int |
Input Parameters |
None. |
Parent object |
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()
Function Declaration |
|
Type |
Object method |
Description |
Returns the internal NetSuite ID for the class on a StandardLine or CustomLine object. Use this method to define plug-in implementation functionality based on the class for a GL impact line. See also setClassId(classId). Classes are categories that you can create to track records such as financials, transactions, and employees. You can view all classes defined in NetSuite at Setup > Company > Classes. You can use helper functions in a utility file to avoid adding the internal NetSuite IDs into the plug-in implementation logic. See Utility Files for a Custom GL Lines Plug-In Implementation. |
Returns |
int |
Input Parameters |
None. |
Parent object |
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()
Function Declaration |
|
Type |
Object method |
Description |
Returns the credit amount for a StandardLine or CustomLine object. Use this method to define plug-in implementation functionality based on the credited amount for a GL impact line. See also setCreditAmount(credit). |
Returns |
string |
Input Parameters |
None. |
Parent object |
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()
Function Declaration |
|
Type |
Object method |
Description |
Returns the debit amount for a StandardLine or CustomLine object. Use this method to define plug-in implementation functionality based on the debited amount for a GL impact line. See also setDebitAmount(debit). |
Returns |
string |
Input Parameters |
None. |
Parent object |
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()
Function Declaration |
|
Type |
Object method |
Description |
Returns the internal NetSuite ID for the department on a StandardLine or CustomLine object. Use this method to define plug-in implementation functionality based on the department for a GL impact line. See also setDepartmentId(departmentId). Departments are listed first on transactions, and are useful when designating transactions and employees as part of an internal team. You can view all departments defined in NetSuite at Setup > Company > Departments. You can use helper functions in a utility file to avoid adding the internal NetSuite IDs into the plug-in implementation logic. See Utility Files for a Custom GL Lines Plug-In Implementation. |
Returns |
int |
Input Parameters |
None. |
Parent object |
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()
Function Declaration |
|
Type |
Object method |
Description |
Returns the internal NetSuite ID for the entity on a StandardLine or CustomLine object |
Returns |
int |
Input Parameters |
None |
Parent object |
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()
Function Declaration |
|
Type |
Object method |
Description |
Returns the internal NetSuite ID for the location on a StandardLine or CustomLine object. Use this method to define plug-in implementation functionality based on the location for a GL impact line. See also setLocationId(locationId). Use locations to track information about employees and transactions for multiple offices or warehouses. You can view all locations defined in NetSuite at Setup > Company > Locations. You can use helper functions in a utility file to avoid adding the internal NetSuite IDs into the plug-in implementation logic. See Utility Files for a Custom GL Lines Plug-In Implementation. |
Returns |
int |
Input Parameters |
None |
Parent object |
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()
Function Declaration |
|
Type |
Object method |
Description |
Returns the Memo field on a StandardLine or CustomLine object. The Memo field is populated from fields on the transaction, for example, the Description field for a line item on a Invoice transaction. See also setMemo(memo). |
Returns |
string |
Input Parameters |
None. |
Parent object |
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)
Function Declaration |
|
Type |
Object method |
Description |
Returns the internal NetSuite ID for the custom segment value set on the line on a StandardLine or CustomLine object. Use this method to define plug-in implementation functionality based on the value for a GL impact line. |
Returns |
int |
Input Parameters |
segmentId {string} — String value of the custom segment ID |
Parent object |
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;
}