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
CharlieLangCharlieLang 

company name

Hi,

 

Is there a quick way that i can get the company name of the user using this part of my controller or do i have to create another variable and soemhow add it to that?

 

I was wodnering if there was a way in being able to pull the information from the system.userinfo field?

 

 

public with sharing class CaseExtension {
    
    public Case mycase {get; set;}
    public User localUser {get; set;}
    public String route {get; set;}
    
    public CaseExtension(ApexPages.StandardController stdController) {
        this.mycase = (Case)stdController.getRecord();
        localUser = [SELECT Id, Phone, Email, FirstName, LastName from User where Id =: System.UserInfo.getUserId() LIMIT 1];
        this.mycase.OwnerId = localUser.Id;
        
    }

Thanks for any help in advance!

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Shoby Abdi.ax910Shoby Abdi.ax910

This should cover it

 

SELECT CompanyName FROM User

 

There is a field on the User record called CompanyName

All Answers

Shoby Abdi.ax910Shoby Abdi.ax910

This should cover it

 

SELECT CompanyName FROM User

 

There is a field on the User record called CompanyName

This was selected as the best answer
CharlieLangCharlieLang

Thanks!!

 

I just couldn't work out what the field was called!