0

Why Do I get this error in the below code?

Error

expecting right square bracket, found 'in'

Code

trigger ProposalTriggerTest on Proposal__Proposal__c (after update) {
    try{
        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);           

            updateList.add(current);
        }
        if(updateList.size()>0) update updateList;


         }catch(Exception e){} 
     }

1 Answer 1

6

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.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .