You need to sign in to do that
Don't have an account?
Filipe Baradelli
expecting right curly bracket, found 'trigger'
I'm trying to create an Opportunity and insert it a product. It's the message that appears when I put the trigger : expecting right curly bracket, found 'trigger'. Someone can help me?
opp = new Opportunity(); opp.Name = 'Test'; opp.CloseDate= System.Today(); opp.StageName='Prospecting'; insert opp; oppLineItem = new OpportunityLineItem(); oppLineItem.OpportunityId = opp.Id; oppLineItem.UnitPrice =1000; oppLineItem.Quantity =1; insert oppLineItem; trigger CreateOLI on Opportunity (after insert) { List<OpportunityLineItem> oliList = new List<OpportunityLineItem>(); List<PriceBookEntry> priceBookList = [SELECT Id, Product2Id, Product2.Id, Product2.Name FROM PriceBookEntry WHERE Product2Id= pr.Id]; insert oliList; }
I put the imcomplete code, here's the product pr being added.