You need to sign in to do that
Don't have an account?
d.tejdeep@nicomatic.in
Master_id__c is a link field between Quote_line_item__c and batch
For Every action I am using this map to put
At last i want to insert those values in Map blist how can i do that help me ?
How to compete thsi save logic .Help me
How to insert Map key and vales while save action ?
Public Map<Quote_line_item__c,list<batch__c>> blist{ get; set;} public list<batch__c> ctlist{get; set;} Quote_line_item__c acc= new Quote_line_item__c(Master_Id__c='Qli'+count); ctlist=new list<batch__c>(); batch__c ct=new batch__c(Dummy_field__c='BTH'+bcount,Quote_line_item__r=new Quote_line_item__c(Master_Id__c='Qli'+count)); ctlist.add(ct); blist.put(acc,ctlist);
Master_id__c is a link field between Quote_line_item__c and batch
For Every action I am using this map to put
At last i want to insert those values in Map blist how can i do that help me ?
for(quote_line_item__c q:blist.keyset()){ For(batch__c b: ){ } }
How to compete thsi save logic .Help me
I assume that you need to insert key of map as parent objects and value of map as child object. So you need to assign parent record id to its child record and which is possible after insert parent records before inserting child records.
Please try with below code. Before execute that code I assume that you have prepared your map with Quote line item and its batch which needs to insert.
Thanks & Cheers,
Jigar (pateljb90@gmail.com)
All Answers
visualforce page:
In my visualforce page,I have a buttons ike "Add parent" "Add child" .
Initially when i click on add parent it will show me the layout of inserting one parent,one child
when i clik on add child i will add child in layout bychecking field master_id__c in parent it will add
For every add buttons "I am updating this map using put " Public Map<Quote_line_item__c,list<batch__c>> blist{ get; set;}
Every thing done at the UI only and last i want to insert this Map Blist into databse
I assume that you need to insert key of map as parent objects and value of map as child object. So you need to assign parent record id to its child record and which is possible after insert parent records before inserting child records.
Please try with below code. Before execute that code I assume that you have prepared your map with Quote line item and its batch which needs to insert.
Thanks & Cheers,
Jigar (pateljb90@gmail.com)