You need to sign in to do that
Don't have an account?
urgent issue
hi
this is my trigger when i am trying to insert two fulfilments of same item and warehouse then its saying dupolicate id and is unable to update my list so how can i resolve my issue plz help
trigger Wow_Fulfillment_FIFO_SNUM_LOTNUM on Fulfillement__c (after insert,after update) {
public list<Inventory_Transaction__c> ITList1{get;set;}
ITList1 = new List<Inventory_Transaction__c>();
for(Fulfillement__c f:trigger.new)
{
Inventory_Transaction__c[] IT = [select id,Item__c,Qty_In__c,Dev_Bucket_Qty_Remaining__c,Qty_Out__c,warehouse__c
from Inventory_Transaction__c where Item__c =:FF.Item__c AND
Warehouse__c =:FF.warehouse__c AND Dev_Bucket_Qty_Remaining__c != 0
Order By Date__c asc];
IT[0].qty_out__c =IT[0].qty_out__c+FF.qty_out__c;
ITList1.add(IT[0]);
}
update ITList1;
}
i have updated it in the list to avoid dml staement error but its giving me duplicate id to update so plz help how to remove the duplicate id that comes into a list
trigger Wow_Fulfillment_FIFO_SNUM_LOTNUM on Fulfillement__c (after insert,after update) {
public list<Inventory_Transaction__c> ITList1{get;set;}
ITList1 = new List<Inventory_Transaction__c>();
set<string> sSetItems=new set<string>();
set<string> ssetWareHouse=new set<string>();
for(Fulfillement__c FF:trigger.new)
{
sSetItems.add(FF.Item__c);
ssetWareHouse.add(FF.warehouse__c);
}
Inventory_Transaction__c[] IT = [select id,Item__c,Qty_In__c,Dev_Bucket_Qty_Remaining__c,Qty_Out__c,warehouse__c
from Inventory_Transaction__c where Item__c in:sSetItems AND
Warehouse__c in:ssetWareHouse AND Dev_Bucket_Qty_Remaining__c != 0
Order By Date__c asc];
change as like above..then create Map to use it and update the values accordingly....