Currency format in Salesforce Visualforce Page
1K views
Jan 15, 2025
Currency format in Salesforce Visualforce Page can be done using apex:outputText and apex:outputField. For example code, check the Blog Post: https://www.infallibletechie.com/2014/09/currency-format-in-visualforce-page.html
View Video Transcript
0:04
foreign
0:07
in this video we are going to see how to
0:11
do currency formatting in Salesforce
0:13
visual Force pages
0:17
whenever we design a visual first page
0:19
and if we wanted to display a currency
0:21
format as per our
0:25
um
0:26
business requirement then we can make
0:30
use of
0:31
output text and in the value you can
0:34
Define the format
0:36
so in here I am
0:39
defining the format as a number
0:42
and it should be in this format
0:47
in few countries
0:50
we say hundred thousand in few countries
0:53
we say one lakh
0:55
so
0:57
if it is going to be hundred thousand
0:59
then it should be three digits followed
1:01
by comma and three digit number
1:04
but in case of
1:07
different countries where they use one
1:09
lakh then it should be 1 for comma
1:12
followed by two zeros
1:14
comma followed by three Z three zeros so
1:17
the format varies as per the the country
1:21
and the business requirements so we you
1:23
can Define that format here so here I am
1:26
using that hundred thousand format
1:30
and then I'm using
1:32
Apex param and then value I'm displaying
1:35
a b and c
1:38
this is one way of doing the currency
1:41
format and visual first page the other
1:44
way is
1:45
we can use the same output text in the
1:48
value attribute
1:49
you can mention number comma currency
1:54
so that it will take Salesforce a way of
1:58
displaying the currency and then it will
2:01
display
2:02
this is the easiest way
2:05
and it takes care of the the amount
2:07
length and everything here you have to
2:10
define the length properly else it will
2:12
truncate the values so which will be
2:15
confusing for the users so you can use
2:19
this format
2:21
so that Salesforce will parse and
2:23
display it as per their
2:26
logic in it so let's see this also here
2:30
in order to display I have declared a
2:32
variable called int
2:35
so in my Apex class I have declared four
2:38
variables a b and c and int to display a
2:44
b and c and inte
2:46
here I'm declaring area 1800 200
2:50
3456 7.09 and here I'm using 098.23
2:57
so I'm going to
2:59
display this
3:03
so here it is
3:05
1800
3:09
because why it is displaying eight zero
3:11
zero one is here it will display three
3:16
three numbers and then it will be
3:19
followed by one
3:20
so let's increase the value so that we
3:22
can see that output
3:32
so automatically it will display in the
3:34
format I have declared
3:52
so
3:54
he may make use of
3:57
this numbering format
3:59
or
4:00
this numbering format let's say you
4:03
wanted to display dynamically based on
4:05
the
4:08
um
4:09
current uses locally then we can make
4:12
use of Apex output field
4:15
when we use Apex output field the values
4:20
will be displayed based on the user's
4:23
current locally
4:24
so if we wanted to display
4:27
amount
4:29
field value in my current local a then I
4:34
can make use of Apex output field
4:45
please check the video description
4:47
I have shared my blog post
4:50
from the blog post you should be able to
4:52
get the sample code which we referenced
4:54
in this video
4:57
use this sample code as a reference and
5:00
build as per your business requirement
5:11
I hope it was helpful
5:24
thank you for watching
#Business & Productivity Software
#Computer Education
#Currencies & Foreign Exchange
#Internet Software
#Investing
#Other