function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
James George 717James George 717 

Unexpected token, simple code. please help

Hi All,
Please help me on this issue, what can be the reason.

public class OpportunityTriggerHandler extends TriggerHandler {
    private Map newOppMap; 
     private Map OldOppMap; 
     public OpportunityTriggerHandler() {
         this.newOppMap = (Map) Trigger.newMap;
         this. OldOppMap  = (Map) Trigger.oldMap; 
     } 
 }

trying to save the code found on this link:

https://360coder.wordpress.com/2019/07/04/triggerhandler-salesforce/


Error screenshot

User-added image

ShirishaShirisha (Salesforce Developers) 
Hi James,

Greetings!

The code given in the link is the example which doesn't have the complete code.As per the documentation you need to create the Map to pass the Ids or string.Please find an example in the below link:

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_map.htm

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
James George 717James George 717
Thanks Shirisha