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
    Commented Feb 1, 2017 at 11:07
  • @Reshma Sorry I don't understand what you mean
    – Json
    Commented Feb 1, 2017 at 11:12

1 Answer 1

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
    Commented Feb 1, 2017 at 11:29

You must log in to answer this question.

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