You need to sign in to do that
Don't have an account?
naveen reddy 68
My Question is based on trigger, I have two date fields by calculating the difference between two fields it has to create the records on the same object
In this program the for loop is not working
trigger calculation on calculation__c (before insert,before update)
{
list<calculation__c>cal1=new list<calculation__c>();
for(calculation__c cal:trigger.new)
{
integer intDays = cal.Open_date__c.daysBetween(cal.closed_date__c);
system.debug(intDays);
if(intDays!=null)
{
for(integer i=1;i<=intDays;i++)
{
for(calculation__c cl:trigger.new)
{
if(trigger.isInsert)
{
cal.customer_Name__c='naveen';
cal1.add(cal);
}
//insert cal1;
}
}
}
}
}
trigger calculation on calculation__c (before insert,before update)
{
list<calculation__c>cal1=new list<calculation__c>();
for(calculation__c cal:trigger.new)
{
integer intDays = cal.Open_date__c.daysBetween(cal.closed_date__c);
system.debug(intDays);
if(intDays!=null)
{
for(integer i=1;i<=intDays;i++)
{
for(calculation__c cl:trigger.new)
{
if(trigger.isInsert)
{
cal.customer_Name__c='naveen';
cal1.add(cal);
}
//insert cal1;
}
}
}
}
}