+ Start a Discussion
Mano sfdcMano sfdc 

Compile Error: Class Successfully Saved, once deleted and copied the same code just change class name - now showing error

Error: Compile Error: Invalid identifier '    public String getObjType'. Apex identifiers must start with an ASCII letter (a-z or A-Z) followed by any number of ASCII letters (a-z or A-Z), digits (0 - 9), '$', '_'. at line 3 column 1


public class UserRoleHierarchyController
{
    public String getObjType() 
    {
        return String.valueOf(Account.sObjectType);
    }
    
    public UserRoleHelper.RoleNodeWrapper getRootNodeOfTree(Id roleOrUserId) 
    {
        return UserRoleHelper.getRootNodeOfUserTree(roleOrUserId);
    }

    public String getJsonString() 
    {
        String str = null;
        str = UserRoleHelper.getTreeJSON('00E7F000001qt7I');
        return str; 
    }
    
    public String selectedValues {get; set;}
  
}
Narender Singh(Nads)Narender Singh(Nads)
Hi,

Try this code:
 
public class UserRoleHierarchyController
{
    public String getObjType() 
    {
        return String.valueOf(Account.sObjectType);
    }
    
    public UserRoleHelper.RoleNodeWrapper getRootNodeOfTree(Id roleOrUserId) 
    {
        return UserRoleHelper.getRootNodeOfUserTree(roleOrUserId);
    }

    public String getJsonString() 
    {
        String str = null;
        str = UserRoleHelper.getTreeJSON('00E7F000001qt7I');
        return str; 
    }
    
    public String selectedValues {get; set;}
  
}

Let me know if it helps.
Thanks