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
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