Why Do I get this error in the below code?


expecting right square bracket, found 'in'


trigger ProposalTriggerTest on Proposal__Proposal__c (after update) {
        list < Proposal__Proposal__c > updateList  =  new list < Proposal__Proposal__c > (); 
        list < Proposal__Proposal__c > currentProposalList  =   [ Select id , (Select LineType__c, NetPrice__c From ProposalSummaryGroups__r where LineType__c = 'Grand Total' ), Quoting_Country__r.Rounding_Method__c  From Proposal__Proposal__c in :trigger.new ];
        system.debug('####Check currentSummaryGroups : '+currentProposalList);
        for (Proposal__Proposal__c proposal : currentProposalList) {
            system.debug('####Check  -  Before Net : '+proposal.ProposalSummaryGroups__r[0].NetPrice__c);           

            proposal.ProposalSummaryGroups__r[0].NetPrice__c   =  proposal.ProposalSummaryGroups__r[0].NetPrice__c +100; 

            system.debug('####Check  -  After Net : '+proposal.ProposalSummaryGroups__r[0].NetPrice__c);           

        if(updateList.size()>0) update updateList;

         }catch(Exception e){} 

This is not valid syntax:

SELECT ... FROM Proposal__Proposal__c in :trigger.new

Instead, you likely want to filter based on Id:

SELECT ... FROM Proposal__Proposal__c WHERE Id IN :trigger.new

Also, your code uses one of the worst patterns you could possibly implement: to wrap your entire code in a try/catch, especially with an empty catch block. Never implement an empty catch block.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.