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
Mrityunjay Patel 18Mrityunjay Patel 18 

Any one can help me how to fetch the current user address like city,state,country in apex

Best Answer chosen by Mrityunjay Patel 18
Ashish Singh SFDCAshish Singh SFDC
Hi Mrityunjaym,

Basically, you would have to do it in apex.

User u = [SELECT Id, Name, City, Country FROM User where Id:=UserInfo.getUserId()];
System.debug(u.Name);
System.debug(u.City);
System.debug(u.Country);
System.debug(u.Id);

Refer to the User Info Class (https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_userinfo.htm) for more info.

Thanks,
Ashish Singh