customizeGlImpact Function in Detail:
Dear Reader,
This post is all about method used in CustomizeGlImpact function .
You can use these methods to customize function as per you need. You can add additional logic
inside function.
Function Declaration:
void customizeGlImpact(Record transactionRecord, StandardLines
standardLines, CustomLines customLines, AccountingBook book)
Type:
Interface function
Return: void
Parameters: Standard Lines , custom Lines, Accounting book, record
Parameters in Detail:
Standard Lines: Contains an array of all
standard lines with GL impact in a transaction as StandardLine
objects.
Standard lines are the general ledger impacts that appear on the GL
Impact
report for a transaction.
function customizeGlImpact(transactionRecord, standardLines, customLines, book)
{
for (var i = 0; i < standardLines.getCount(); i++)
{
var currLine = standardLines.getLine(i);
//add your logic here.
}
}
Custom Lines: Contains an array of all custom lines with GL impact in a transaction as CustomLine
objects. Use this object to add and modify custom lines with GL impact on a transaction.
Create a new CustomLine object with addNewLine().
addNewLine():
function customizeGlImpact(transactionRecord, standardLines, customLines, book)
{
var newLine = customLines.addNewLine();
newLine.setCreditAmount(100);
newLine.setAccountId(12121);
newLine.setMemo("set Your message");
var newLine = customLines.addNewLine();
newLine.setDebitAmount(100);
newLine.setAccountId(12122);
newLine.setMemo("set your message");
}
getCount() and getLine():
function customizeGlImpact(transactionRecord, standardLines, customLines, book)
{
for (var i = 0; i < customLines.getCount(); i++)
{
// get the line
var currLine = customLines.getLine(i);
}
}
Accounting Book: Represents the accounting book passed to a Custom GL Lines plug-in implementation when you save a transaction.
Accounting book has 2 methods:
1. getId()
2. isPrimary()
function customizeGlImpact(tRecord, sLines, cLines, mBook)
{
var pBook= mBook.getId();
if (!mBook.isPrimary())
{
var abRec= nlapiLoadRecord('accountingbook',pBook);
}
}
Record: This parameter represent transaction record passed in function.
Contains method:
getAllFields(): Returns a normal keyed array of all the fields on a record.
getAllLineItemFields(group): Returns an array of all the field names of a
sublist on the record.
getFieldText(name) : Returns the UI display value for a select field.
getFieldTexts(name) : Returns the UI display values for a multi-select field.
getFieldValue(name) : Returns the value (internal ID) of a field.
getFieldValues(name): Returns the value (field ID) or
values (array of field IDs) of a multi-select field.
getId(): Use this method to get the internal ID of a record when editing an
existing transaction.
getLineItemCount(group): Returns the number of lines on a sublist.
getLineItemText(group, fldnam, linenum): Returns the display name of a select field (based on its
current selection) in a sublist.
getLineItemValue(group, name, linenum): Returns the value of a sublist line item field.
getLineItemValues(type, fldnam, linenum): Returns the values of a multiselect sublist field
getLineItemValues(type, fldnam, linenum): Returns the values of a multiselect sublist field
on a selected line.
getRecordType(): Returns the record type. For example, returns SalesOrd for the Sales Order
getRecordType(): Returns the record type. For example, returns SalesOrd for the Sales Order
record type.
viewLineItemSubrecord(sublist, fldname, linenum): Returns a nlobjSubrecord object. Use this API to
viewLineItemSubrecord(sublist, fldname, linenum): Returns a nlobjSubrecord object. Use this API to
view a subrecord from a sublist field on the parent
record.
viewSubrecord(fldname): Returns a nlobjSubrecord object.
viewSubrecord(fldname): Returns a nlobjSubrecord object.
Thanks
Team Netsuite Guru
Download Netsuite Guru Android App
Follow Me on Linkedin
Our FB Page
Comments
Post a Comment
Thanks for you message, please join us on Facebook and Linkedin