You need to sign in to do that
Don't have an account?
Dolgoldy
issue in script running
Hi all,
Here is script to create related record for opprtunity for month jan,feb,march but its not working. please help me to solve it.
//Script
MapId, Opportunity oppItems = new MapId, Opportunity();
listARRCalcualateOpportunity__c Arropplist= new listARRCalcualateOpportunity__c();
for(opportunity oppTrigger.New){
if(opp.StageName == 'closed Won')
{
oppItems.put(opp.Id, opp);
}
}
ListOpportunityLineItem oliList = [select Id,Name,Product2Id,Product2.Family from
OpportunityLineItem where OpportunityId IN oppItems.keySet()];
for(OpportunityLineItem oli oliList){
if(oli.product2.family == 'software Recurring__c')
{
ARRCalcualateOpportunity__c arrOpp = new ARRCalcualateOpportunity__c();
arropp.name = oppItems.get(oli.OpportunityId).Name;
arropp.ownerId = oppItems.get(oli.OpportunityId).OwnerId;
arropp.OpportunityArr__c=oppItems.get(oli.OpportunityId).Id;
Arropplist.add(arropp);
}
}
if(Arropplist.size() 0){
insert Arropplist;
}
}
}
Here is script to create related record for opprtunity for month jan,feb,march but its not working. please help me to solve it.
//Script
MapId, Opportunity oppItems = new MapId, Opportunity();
listARRCalcualateOpportunity__c Arropplist= new listARRCalcualateOpportunity__c();
for(opportunity oppTrigger.New){
if(opp.StageName == 'closed Won')
{
oppItems.put(opp.Id, opp);
}
}
ListOpportunityLineItem oliList = [select Id,Name,Product2Id,Product2.Family from
OpportunityLineItem where OpportunityId IN oppItems.keySet()];
for(OpportunityLineItem oli oliList){
if(oli.product2.family == 'software Recurring__c')
{
ARRCalcualateOpportunity__c arrOpp = new ARRCalcualateOpportunity__c();
arropp.name = oppItems.get(oli.OpportunityId).Name;
arropp.ownerId = oppItems.get(oli.OpportunityId).OwnerId;
arropp.OpportunityArr__c=oppItems.get(oli.OpportunityId).Id;
Arropplist.add(arropp);
}
}
if(Arropplist.size() 0){
insert Arropplist;
}
}
}