function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
w.mohan@isidsea.comw.mohan@isidsea.com 

Add multiple line items to an invoice

I need help on the scripting to add multiple line items in an invoice. This is to store many line items one by one after clicking a button  for example 'Add More'

kiranmutturukiranmutturu

 

list<yourobject> lstobject = new list<yourobject>();
 public void AddLineItem(){
        objectname obj = new objectname();
        lstobject.add(obj);
    }//eof Add Line Item

 public list<yourobject> getobjectDetails(){

                return lstobject;

        }

 

 

 

then in the page:

 

put a command button the use the action method and call the addlineitem method and rerender the getObjectDetails property

designer11designer11

I'm trying to do the same thing except it is for multiple order line items rather than invoices.  Did this solution work for you?  Would you mind sharing the final code you used? 

DRobi83DRobi83

Hi Kiran


Are you able to expand on your code here?  Should there be some code before the list (line 1). I get the error Error: Compile Error: unexpected token: 'list' at line 1 column 0

 

 

list<miiFinance__Invoice_Line_Item__c> lstobject = new list<miiFinance__Invoice_Line_Item__c>();
 public void AddLineItem(){
        objectname obj = new objectname();
        lstobject.add(obj);
    }//eof Add Line Item

 public list<miiFinance__Invoice_Line_Item__c> getobjectDetails(){

                return lstobject;

        }