Advanced Line Manager
Overview
The Advanced Line Manager (ALM) component is a datatable used to manage a parent record's children. This functionality is made available as a Lightning Web Component which can be added to pages and configured from the Lightning App Builder. ALM produces two types of events - create row, and row change. How these are handled can be customized, giving developers the ability to modify the target row's data. The events and handlers are Apex based due to limitations in LWC at the time of publishing.
Row Create Events
When a new row is added to the ALM an ALMRowCreateEvent
is fired and can be handled by an ALMRowCreateHandler
. This facilitates modification of the new row's data before it is displayed, allowing developers to set default values.
To respond to an ALMRowCreateEvent
implement the ALMRowCreateHandler
interface. The below example creates new Payable Lines with Date__c
set to today's date.
public class YourClassName implements ALMRowCreateHandler{
public List<SObject> createRow(ALMRowCreateEvent event){
// create a list to hold the new Payable Lines
List<Account_Payable_Line__c> lines = new List<Account_Payable_Line__c();
// create the number of rows specified by createRowsCount
for(Integer i=0; i<event.createRowsCount; i++){
// create a new row with some default values
lines.add(new Account_Payable_Line__c(
Date__c = System.today()
));
}
// return the new lines
return lines;
}
}
ALM can be configured to used a custom ALMRowCreateHandler
by setting the Row Template
attribute in the Lightning App Builder. Detailed instructions can be found in the Knowledge Base.
Row Change Events
When a row is changed an ALMRowChangeEvent
is fired and can be handled by an ALMRowChangeHandler
. This facilitates modification of the updated row's data before the changes are displayed, allowing developers to react to the changes.
To respond to an ALMRowChangeEvent
implement the ALMRowChangeHandler
interface. The below example checks if Internal_Comment__c
is 'One Hundred', and if so it sets the Unit_Price__c
to 100.
public class YourClassName implements ALMRowChangeHandler{
public SObject updateRow(ALMRowChangeEvent event){
// cast the row to the correct type
Account_Payable_Line__c line = (Account_Payable_Line__c) event.updatedRow;
// react to changes in the internal comment field
if (line.Internal_Comment__c == 'One Hundred') {
payableLine.Unit_Price__c = 100;
}
// return the updated row
return payableLine;
}
}
ALM can be configured to used a custom ALMRowChangeHandler
by setting the Row Change Handler
attribute in the Lightning App Builder. Detailed instructions can be found in the Knowledge Base.