Questions tagged [formatting]

About formatting data such as String, Datetime, etc.

Filter by
Sorted by
Tagged with
0
votes
0answers
27 views

Empty lines after each line in LWC meta files

After sfdx force:source:retrieve -x manifest/package.xml my meta files (only LWC) have empty empty lines after each line. Before retrieve: <LightningComponentBundle xmlns="http://soap.sforce....
4
votes
2answers
258 views

formatGMT YYYY returning next year and yyyy returning this year?

We noticed a behavior with formatGmt function especially around using YYYY vs yyyy, anyone facing the same? Below is showing one year ahead: system.debug('GMT Time'+System.now().formatGmt('E, dd MMM ...
0
votes
1answer
46 views

Date format in Marketing Cloud email based on locale

I am looking to show the date in two different formats based on locale (the locale variable is set to LocaleCode earlier in the email). For en-US it should be January 1, 2021 and all other locales it ...
0
votes
1answer
19 views

Change DoB format to 'yyyymmdd' in Marketing Cloud

I am trying to pull in DoB from a Data extension via ampscript and change the date format to be 'yyyymmdd' where am i going wrong? %%[var @DoB, SET @DoB = [Date_of_Birth__c] ]%% set @DoB = ...
0
votes
0answers
8 views

Is there a way to format an incoming email-to-case message so that line breaks are preserved?

When an email is sent to our defined SFDC email address, with [refID=] properly included, the email populates in the referenced record. However the email is displayed in the record as a continuous ...
1
vote
1answer
46 views

Use Prettier in VS Code to format Visualforce

I'm struggling to get the Prettier for Apex (installed as per instructions here enter link description here) to format Visualforce Pages and Components. I have a vague memory of this working for me in ...
5
votes
1answer
209 views

Is the time-zone attribute broken in lightning-formatted-date-time?

Based on my reading of the documentation that includes statements like this: When using the component to display a date only, without time, include time-zone="UTC" to ensure the correct ...
1
vote
2answers
75 views

In Apex, how can I format Datetime for Europe/Berlin without assuming the input value is GMT?

I currently have the following function: public String formatForGermany(Datetime targetTime) { return this.format(targetTime, 'Europe/Berlin'); } private String format(Datetime targetTime, String ...
0
votes
1answer
33 views

How to format my Salesforce time field for input in visualforce?

I have a time field (new time field format) called Time_In_1__c in a visualforce page. When I enter a value such as "3:00 pm" and hit save, Salesforce displays the value as 15:00:00:000. I'...
1
vote
2answers
126 views

How to format a date in a javascript?possible [closed]

How can I format a date object to print as today instead of showing a numeric date in a javascript? I'd like to display it like this: today At 5:00 PM. js var today = new Date(); var date = new Date(...
5
votes
1answer
213 views

Any formatting JavaScript APIs in LWC?

I'd like to format a currency value that a user inputs in a modal dialog as part of a lightning-datatable field that is composed of some fixed text and that currency value. But AFAIK there are no ...
1
vote
1answer
257 views

Prettier formatting tabSize and printWidth

In VS Code preference, I set the Tab Width = 4 and Print Width = 120, but when I format, I can still see the tabSize being 2. Is there any other configuration that I need to do? Thanks.
0
votes
0answers
34 views

Replacing HTML Code in a String [duplicate]

We're being passed a field in a data string with the HTML code '&dollar;'. We're wanting to change that to '$', since when we send emails it still shows as '&dollar;' and not '$' on a web page....
0
votes
1answer
42 views

Ampscript to change a certain value in a dynamic field

So our data team is passing a value in a data extension that they want to display as a dollar sign, e.g. "$0.499". However, when read in our email, it displays the HTML and not '$'. Is there ...
1
vote
1answer
32 views

Is there a way to invoke Salesforce's phone number formatter on a given string?

I want to take all the phone numbers for a given contact in from a SOQL query (which provides the phone number in a raw format) and then have all of the phone numbers in this format as options in a ...
1
vote
1answer
76 views

Format decimal according to locale, but with fixed number of decimal places

There were many question around the topic of formatting decimals according to user's locale and rounding decimals, but I haven't seen the one that actually fits my case, so here I go. I am creating ...
0
votes
0answers
278 views

Salesforce removing line breaks when importing data from CSV

We're currently busy with a migration of data from our old system to our brand new Salesforce system. As part of this migration, we're migrating data fields that contain flat text with line breaks, ...
0
votes
1answer
37 views

Apex format function returning weird dates

I am attaching a screenshot which shows a code sample and it's output also. When I normally debug the created date it shows me correct output and then when I try to format it using format function it ...
1
vote
1answer
133 views

Can you format merge fields in Salesforce email templates?

Basically I am trying to create some email templates that send out to our users that contain a phone number. A lot of these phone numbers are formatted with no parathensis or dashes, and are in the ...
3
votes
0answers
60 views

End of File issues with Prettier formatting for javascript

I've got the following prettier config in my repo. When I commit a .js, .css file for an aura component, save it to salesforce org, and retrieve it, I find that my git repo complains that something ...
1
vote
1answer
37 views

Date formatting for SOQL String - unexpected output

I have '273' added as a day with the following line: DateTime.newInstance(dStart.year(), dstart.month(), dstart.day()).format('DD-MM-YYYY'); so the output looks like '273-09-2019' - what gives? I ...
8
votes
1answer
1k views

How to format Apex code more flexible than with Prettier

Note: This is a Salesforce-specific question so don't close it. Salesforce has contributed a Prettier plugin for Apex so in other forums people cannot help me. I'm new to Prettier and couldn't ...
0
votes
1answer
38 views

Dataloader.io Importing numbers with extra zeros

While trying to import/update some Contract records in my Salesforce system, I have run into issues with the formatting and consistency of currency fields. If I update a currency field with the ...
-3
votes
1answer
1k views

make text highlighted red & bold if criteria is met?

i have a requirement that if my text field has a certain value it should be displayed highlighted red and bold. at first thought i'm thinking i have to change the field type to a formula field that ...
0
votes
1answer
33 views

Format an Integer as a number in VisualForce page

I am trying to format the field BodyLength of the Attachment Object which is an Integer in my VisualForce Page. This should work but it doesn't. <apex:outputText value="{0, number, ###,###,###,###}...
1
vote
1answer
73 views

AMPscript: Including Ordinal Indicators In Date Formatting

I have an automated email that will be sent every month and I'm trying to get the expiry to reference the last date of the current month formatted to read 31st January, 2019 or 28th February, 2019. I'...
1
vote
1answer
208 views

Formatting a derived measure that was calculated from multiple datasets

I understand how to format a derived measure using the XMD. But here, my derived measure comes from multiple datasets. Here is my SAQL: q = load "Dataset1"; q = group q by all; q = foreach q ...
0
votes
2answers
458 views

LWC HTML formatting using prettier

I am using Prettier for formatting HTML code in Lightning web component but it is adding quotes around properties. This is not required for LWC and it throws an error. I tried different Quote Props ...
1
vote
2answers
2k views

Formatting Datetime.now()

I need to format my Datetime.now() to be accepted for a SOAP request. I can't seem to find a way to format it online. Can anyone advise? I need it to look like: 2019-05-02T21:20:29.999Z Currently I ...
1
vote
1answer
1k views

Date Format in VisualForce Page

I need this date format in a visualforce page as MM/dd/yy, below is the code. But in page it display as Fri Mar 08 00:00:00 GMT 201903/08/19, Can you please help me on this? <apex:commandLink ...
0
votes
1answer
1k views

Apex convert string mm/dd/yyyy hh:mm:ss to standard system date (yyyy-mm-dd 00:00:00)

I am trying to convert string from google docs "1/16/2019 11:52:38" to standard system date "2019-01-16 00:00:00". I was able to achieve that using substring method but I am pretty sure there is a ...
1
vote
2answers
5k views

Lightning:datatable number formatting

I have created a lightning:datatable to display order lines. The order lines are fetched via a REST call. I parse the JSON response and add to the datatable data attribute. Everything works fine but ...
1
vote
2answers
2k views

Lightning Component - Date formatting not consistent with standard UI

I am using lightning:datatable to render data including dates. My date column definition looks like: { label: 'Expiration', fieldName: 'ExpirationDate__c', type: 'date'} The date in the table is ...
0
votes
1answer
1k views

Converting Currency to Decimal And Converting Back To Currency Display in Email Template

I have a currency field that I multiply by .5 in my apex code. This changes the data type to a Decimal. I want to display on a visualforce email template the newly updated number as a currency. ...
3
votes
2answers
2k views

Is it possible to make text bold in a custom label?

Background We have a custom application which we need to support in multiple languages. Visualforce is our main UI framework. For internationalization we will use Custom Labels. One of the possible ...
0
votes
1answer
602 views

Unordered List with no bullets not working with email template

I have a Visualforce Component that has a un-ordered list. I want that list to have no style other then the indentation. Usually with HTML you would just specify the ul css to be list-style:none or ...
3
votes
0answers
363 views

Moment JS but for Salesforce Apex

Are there any open source libraries similar to Moment JS but for Apex? Reference: Moment JS
1
vote
1answer
860 views

Break tag inside rich text field in lightning

We use a Visualforce page to automatically fill a rich text field with some generated content. After that, the user is allowed to edit the content before it's displayed on a website. After our ...
0
votes
1answer
586 views

Marketing Cloud - Timezone - Format/Display

I guys. Need your help, please. 1 -I know the dates in Marketing are saved in CST timezone, but when I view them in "form mode" I need to see them as GMT / UCT. I have already set up account and user ...
0
votes
0answers
452 views

Formatting parameterized custom label inside subject for Visualforce Email template

I'm trying to use the format() visualforce function to have a parameterized custom label as my Visualforce Email Template subject. This is my current code: <messaging:emailTemplate ...
0
votes
2answers
512 views

Checkboxes Don't Align on Visualforce page

Checkboxes Don't Align I have two groups of vertical checkboxes on a Visualforce page and the top one in both columns is about two spaces to the left of the others. What is the best way to format the ...
1
vote
1answer
665 views

How to get current user date/time format in apex, e.g. MM/dd/YYYY hh:mm:ss a z

We need to figure out current user date/time format in apex code to send it to our mobile app in order to display data in same way as it is in Salesforce itself. In other words, it's about getting ...
1
vote
1answer
1k views

Visualforce format an output number depending on decimal value, if decimal is zero then just display the number

I am trying to display multiple values in a page which are currency fields set with 2 decimals (in the object). Currently I am using the below expresion to format the values which works great: <...
0
votes
0answers
342 views

Date Format: Apex Callout (Soap webservice)

We are performing an apex callout from Salesforce to a SOAP based webservice and it requires us to pass a date in the following format: MM/DD/YYYY (note: this should be date datatype). When I am ...
1
vote
1answer
9k views

Using lightning:input with type=“number” and formatter=“currency”

Is there a way to use lightning:input with formatter="currency" to show whole number instead of Decimal number <lightning:input aura:id="{!item.Id + 'CY_Tile_Budget__c' }" type="number" name="...
0
votes
1answer
1k views

How do I convert a String to Decimal in Apex using a specific locale?

I am receiving as a response from a third-party webservice a JSON having prices formatted in a different way depending on locale. Below some examples of the format of the text sent (depending on the ...
0
votes
1answer
294 views

How to replicate NumberFormat based on locale in salesforce

I want to show currency on VF page in different formats based on locale used on the template. NumberFormat class is available in Java to achieve this but in apex is there any way to achieve this. ...
0
votes
1answer
2k views

Formatting as a currency on a VF page

I'm trying to render a currency value to a VF page. Whether I use Decimal or String, it still doesn't seem to work with the OutputText formatting :- <apex:column> <apex:facet name="...
0
votes
1answer
966 views

AMPscript Date Formating for French Language in HTML emails

This puts today’s date in my HTML email: %%=Format(Now(), "MMMM d, yyyy")=%% Any idea how to format this for FR? I've tried doing this and it doesn’t work: %%=Format(Now(), "MMMM d, yyyy","fr-CA")=...
1
vote
1answer
167 views

If Statement to format a value depending on a Picklist value of another field

Any Help would be much appreciated- I actually will be doing this for several different currency values If I could use a case statement even better. I know it should be in a class but I do not have ...