You need to sign in to do that
Don't have an account?

Save error: unexpected token: '='
this is bizarre..
I have a sample class to test Sales Team:
OpportunityTeamMember member = new OpportunityTeamMember(); member.OpportunityId = '006Z0000002xxxxxx'; member.UserId = '005Z00000xxxxxx'; member.TeamMemberRole = 'FAE'; insert member;
I get error: Save error: unexpected token: '=' on line 2,3,and 4. Why is this happening? This is driving me crazy..
Your code needs to be inside a function, right now you have it just in the class directly.
All Answers
Hi,
The code looks ok to me. I am assuming that you have written this code either in "Developer Console" or inside your Test class.
Have you copied the code from somewhere? You can remove the '=' and type it again and try to save.
Yes, I did copy paste, my first instict was that too, and I deleted = and typed in again. Not sure what is causing the issue.. this is so frustrating.
Thanks for the comment..
If possible you can paste your entire code here!!
here you go,
Not sure what is going on.. if I comment out 4,5, and 6, it gives me new error "right patenthesis missing }".. looks like I am missing something, not sure what.
Your code needs to be inside a function, right now you have it just in the class directly.
Thanks. I feel like banging my head against the wall.