You need to sign in to do that
Don't have an account?
Illegal assignment from Set<Id> to Id
Hi Guro,
I have the above error. Please help!!!.
trigger OpportunityBillingSchedule on OpportunityLineItem (after insert) {
list<Schedule__c> AddBS = new list<Schedule__c>();
for( OpportunityLineItem olitems : Trigger.new)
{
//populate the account
List<opportunity> oppl = [Select Id, AccountId
from Opportunity
where Id =:olitems.OpportunityId] ;
set<id> opAcc = new set<id>();
for( Opportunity opp: oppl )
{
opAcc.add( opp.AccountId);
}
if (olitems.term__c)
{
Schedule__c BS = new Schedule__c();
BS.name = olitems.name;
BS.Account__c = opAcc;
BS.opportunity__C = olitems.opportunityid;
BS.Billing_amount__c = olitems.unitprice;
BS.Date__c = Date.today(); // olitems.Maintenance_start_date__c;
BS.Status__c = 'Open';
AddBS.add(BS);
}
}
insert AddBS;
}
-----------------------------------------
i did try: BS.Account__c = oppl[1].id ;
but got another error upon saving : System.ListException: List index out of bounds: 1: Trigger.OpportunityBillingSchedule: line 25, column 1
Thank in Advance.
Mary
Excuse me for typos.
All Answers
Please find the code below and then try.
[If you got answer from my post please mark it as solution.]
Thanks,
Kapil
Email (mailto:forcecube@gmail.com)
Excuse me for typos.