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
narsavagepnarsavagep 

$CurrentPage Label (instead of Name)?

Is it possible, in visualforce, to get the label of the current page, instead of the system name?

For example, something like {!$CurrentPage.Label} instead of {!$CurrentPage.Name}

The Page "Label" has spaces in it, the "Name" has underscores... I'd rather show the label to the user rather than the API Name.
Best Answer chosen by narsavagep
Sampath KumarSampath Kumar
Hi Narsavagep.

There is no direct way to get lable using $CurrentPage.Label, instead you can get it from a controller using the folloqing query.
select id,name,MasterLabel from ApexPage where name=:visualforcepagename.

> Pass visualforcepage name as parameter to controller
> MasterLabel is the field to get label of visualforce page from ApexPage.

Let me know if you have any queries.

Regards
Sampath Kumar Goud