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
Ravindar AdminRavindar Admin 

Getting null values for address filed in visualforce page using componet , Even I fill all address data. How to solve this?

User-added image

Component code:

<apex:component >
<h1>Address</h1>
<p>First Name: {!$User.FirstName}</p>
<p>Last Name: {!$User.LastName}</p>
<p>Phone: {!$User.Phone}</p>
<p>Email: {!$User.Email}</p>
<p>Address:{!$User.Address}</p>
</apex:component>

Visualforce Page:

<apex:page standardController="sobject">
<center>
<c:componentname ></c:componentname>
</center>
</apex:page>
Best Answer chosen by Ravindar Admin
Hemant_JainHemant_Jain
Address is a special type of field in Salesforce, which comprises of  Street, City, State, PostalCode, Country, Latitude and Longitude

I suppose Latitude and Longitude are not present on User edit screen. So basically, the fields which are returned as null in your code are Latitude and Longitude.

If you access Address field directly. It is displaying all fields together including Latitude and Longitude. So for your case, you can display the address as per below String:
Address: {!$User.State},{!$User.City},{!$User.Country}...whatever values you want to add or remove.