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
Sandra OSandra O 

Visualforce Email Template - Number field has 1 decimal

I have a visualforce page that displays a number field with a decimal. The actual field does not have any decimals.

How can I adjust the line belwo to dsiplay field Relatedto.Compliants_in_x_days__c with no decimals?
<messaging:emailTemplate subject="{!relatedTo.Complaints_In_X_Days__c}" Complaints or System Failures in the last {!$Label.number_of_days} days for {!relatedTo.Name}" recipientType="User" relatedToType="Account">

 
SandhyaSandhya (Salesforce Developers) 
Hi Sandra,
Please check what is the datatype of ( Compliants_in_x_days__c ) field.IF you have selected decimal as datatype when creating the field then the value will be in decimals.
If you want to convert decimal to number you can use below formula
Decimal myDecimal = 1.602176565;
system.assertEquals(1, myDecimal.intValue());


Please accept my solution as Best Answer if my answer was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
 
Thanks and Regards
Sandhya

 
 
Sandra OSandra O
HI Sandhya,

the field is number with no decimals.  I am sorry, since I do not code - can you help me with how to use that formula within that subject line?

thanks,
Evan PonterEvan Ponter
Hi Sandra,

You can wrap the number field in a TEXT() function to remove the decimal places:
<messaging:emailTemplate subject="{!TEXT(relatedTo.Complaints_In_X_Days__c)}" Complaints or System Failures in the last {!$Label.number_of_days} days for {!relatedTo.Name}" recipientType="User" relatedToType="Account">