You need to sign in to do that
Don't have an account?
Dolgoldy
Script not running
Hi all,
Here is my script to update opprtunity record on reled object for 3 month but its not creating record plz help me
script
list<opportunity> opplist =new list <opportunity>();
List <ARRCalcualateOpportunity__c> ArroppList = new List <ARRCalcualateOpportunity__c>();
for (Opportunity oppobj : opplist)
{
if (oppobj.StageName == 'Closed Won' && oppobj.closedate.month()>=1 && oppobj.closedate.month<=3)
{
for(OpportunityLineItem Oli:[select Id,Name,Product2Id,Product2.Family from
OpportunityLineItem where OpportunityId=:oppobj.Id])
{
if(oli.Product2.Family =='Software Recurring')
{
// To display date in asscending order
Date dt = oppobj.closedate;
for(Integer i =0;i<12;i++)
{
ARRCalcualateOpportunity__c arrObj = new ARRCalcualateOpportunity__c();
arrobj.ARRdate__c = oppobj.CloseDate;
//will display 12 date in ascending order
arrobj.ARRdate__c =dt.addMonths(i);
arrobj.Name = oppobj.name;
arrobj.oppAmount__c = oppobj.Amount;
List<OpportunityLineItem> oppli= [select Id from OpportunityLineItem
where OpportunityId = : oppobj.Id];
arrobj.Opportunity_Product__c = oppli[0].id;
arrobj.OpportunityArr__c= oppobj.Id;
ArroppList.add(arrobj);
}
}
}
}
}
if(arropplist>0){
insert ArroppList;
}
Here is my script to update opprtunity record on reled object for 3 month but its not creating record plz help me
script
list<opportunity> opplist =new list <opportunity>();
List <ARRCalcualateOpportunity__c> ArroppList = new List <ARRCalcualateOpportunity__c>();
for (Opportunity oppobj : opplist)
{
if (oppobj.StageName == 'Closed Won' && oppobj.closedate.month()>=1 && oppobj.closedate.month<=3)
{
for(OpportunityLineItem Oli:[select Id,Name,Product2Id,Product2.Family from
OpportunityLineItem where OpportunityId=:oppobj.Id])
{
if(oli.Product2.Family =='Software Recurring')
{
// To display date in asscending order
Date dt = oppobj.closedate;
for(Integer i =0;i<12;i++)
{
ARRCalcualateOpportunity__c arrObj = new ARRCalcualateOpportunity__c();
arrobj.ARRdate__c = oppobj.CloseDate;
//will display 12 date in ascending order
arrobj.ARRdate__c =dt.addMonths(i);
arrobj.Name = oppobj.name;
arrobj.oppAmount__c = oppobj.Amount;
List<OpportunityLineItem> oppli= [select Id from OpportunityLineItem
where OpportunityId = : oppobj.Id];
arrobj.Opportunity_Product__c = oppli[0].id;
arrobj.OpportunityArr__c= oppobj.Id;
ArroppList.add(arrobj);
}
}
}
}
}
if(arropplist>0){
insert ArroppList;
}
Have you tried setting up debug logs to see what is being fetched in arrobj before it is added to ArroppList? Do you see any errors while execution?
Thanks