You need to sign in to do that
Don't have an account?
KCL
Update your trigger logic to use Database.update and set allornone to false.
trigger EST on Development_Item__c (before insert, before update, after update) {
map<ID,string> releasemap=new map<ID,string>();
for( Development_Item__c di:Trigger.new)
{
if(trigger.isbefore)
{
if(trigger.isinsert)
{
if(di.Sign_off_Date__c!=null)
{
di.Status__c='Ready for PROD';
}
if(di.Business_Ananlyst__c==null)
{
di.adderror('Pls select BA');
}
}
else if(trigger.isupdate)
{
if(di.Sign_off_Date__c==null && trigger.isbefore )
{
di.Status__c='In UAT';
}
}
di.Estimated_QA_hrs__c=0.4*di.Estimated_QA_hrs__c;
}
if(trigger.isafter)
{
system.debug(' debug is ' + di.name );
releasemap.put(di.Release__c,di.Name);
}
}
list<release__c> releaselist=new list<release__c>();
releaselist=[select id,name,Latest_Updated_Dev_Item__c from release__c where id in: releasemap.keyset() ];
system.debug('release is' + releaselist);
for(release__c DE:releaselist)
{
DE.Latest_Updated_Dev_Item__c=releasemap.get(DE.ID);
}
update releaselist;
}
THIS IS MY ORIGINAL CODE.
1. Update your trigger logic to use Database.update and set allornone to false.
2. Iterate through the save result, collect all the errors and store the error into the Error Log object. Collect release record id that has the error and the error message.
3.Insert the errors into error log object
map<ID,string> releasemap=new map<ID,string>();
for( Development_Item__c di:Trigger.new)
{
if(trigger.isbefore)
{
if(trigger.isinsert)
{
if(di.Sign_off_Date__c!=null)
{
di.Status__c='Ready for PROD';
}
if(di.Business_Ananlyst__c==null)
{
di.adderror('Pls select BA');
}
}
else if(trigger.isupdate)
{
if(di.Sign_off_Date__c==null && trigger.isbefore )
{
di.Status__c='In UAT';
}
}
di.Estimated_QA_hrs__c=0.4*di.Estimated_QA_hrs__c;
}
if(trigger.isafter)
{
system.debug(' debug is ' + di.name );
releasemap.put(di.Release__c,di.Name);
}
}
list<release__c> releaselist=new list<release__c>();
releaselist=[select id,name,Latest_Updated_Dev_Item__c from release__c where id in: releasemap.keyset() ];
system.debug('release is' + releaselist);
for(release__c DE:releaselist)
{
DE.Latest_Updated_Dev_Item__c=releasemap.get(DE.ID);
}
update releaselist;
}
THIS IS MY ORIGINAL CODE.
1. Update your trigger logic to use Database.update and set allornone to false.
2. Iterate through the save result, collect all the errors and store the error into the Error Log object. Collect release record id that has the error and the error message.
3.Insert the errors into error log object
Hope the below example helps ..... wupdate your code accordingly. replace update command with Database.update(acctList, false);
Please mark as best answer if the above helps ....!!!