Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global class MerchandiseInventoryClass {
- webservice static void ConverttoInventory(String[] merchandise_id)
- {
- //Convert Merchandise collection into Inventory Collection...
- Merchandise__c[] merchandise_collection = [SELECT ID,Author__c,Book_Title__c,Edition__c,Publisher__c,Total_Merchandise_QtyTotal_Qty__c,Status__c FROM Merchandise__c WHERE ID = :merchandise_id];
- Inventory__c i = new Inventory__c(); //Line 1
- List<Inventory__c> newInventory = new List<Inventory__c>();
- for(Merchandise__c m : merchandise_collection )
- {
- if(m.Status__c !='Fully Converted')
- {
- i.Author__c = m.Author__c ;
- i.Book_Title__c = m.Book_Title__c;
- i.Edition__c = m.Edition__c;
- i.Publisher__c = m.Publisher__c;
- i.Qty_Available__c = m.Total_Merchandise_QtyTotal_Qty__c;
- i.Merchandise__c = m.Id;
- m.Uninventoried_Qty__c = 0;
- m.Status__c = 'Fully Converted';
- newInventory.add(i);
- }
- }
- insert newInventory;
- update merchandise_collection;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement