1

This is the error I get: unexpected token: 'User' (Line: 6, Column: 2)

global with sharing class Chat_Enterprise_PreChatController {

    @remoteAction
    global static Boolean updateContactDetails {

        User user = [select Id , ContactId from User where id=:userInfo.getUserId() ];
        if(user.ContactId != null){
            Contact con = [SELECT Account_Name__c,Email,FirstName,Id,LastName FROM Contact where Id=:user.ContactId ];

            if(con!=null)
            {
                return con;
            }
        }
        return false;
    }
}

Why is this happening?

2
  • 1
    Its a method. Add () after updateContactDetails – Reshma Feb 1 '17 at 11:07
  • @Reshma Sorry I don't understand what you mean – Json Feb 1 '17 at 11:12
4

@Remoteaction is denoting a method always. You have missed () enclosing parenthesis.

This is how a method is declaring.

[public | private | protected | global] [override] [static] ***data_type*** method_name 
(input parameters) 
{
// The body of the method
}

Change this line

global static Boolean updateContactDetails {

to

global static Boolean updateContactDetails() {

See more on Methods.

1
  • hahah I missed it! – Json Feb 1 '17 at 11:29

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.