Questions tagged [formatting]

About formatting data such as String, Datetime, etc.

Filter by
Sorted by
Tagged with
0 votes
1 answer
161 views

Ampscript for multi language: date format in code

I am a beginner in AMPscript and I am facing an issue. I would like to convert a date format into the customer language. For now, I was able to convert the format from "xx/xx/xxxx" into &...
user avatar
1 vote
1 answer
683 views

Formatting of lightning-output-field in grid with LWC

I'm trying to display 2 columns of data in a LWC using . They are displaying ok (ideally I would want the labels not wrapping) but when I resize the browser window, some of the columns can jump to ...
user avatar
  • 13
0 votes
1 answer
29 views

Default Date/Time In Medium Format 28 Jan 2008, 16:30:05 instead of 28/01/2008, 16:30

Company would like to display the Date format in SF to show the month as text (e.g. Jan instead of 01). From the following article this appears to be the a OOB option by setting the users Local to ...
user avatar
0 votes
0 answers
76 views

apex:OutputText - Format Currency from CurrencyIsoCode on Record, not User Currency?

Based on other answers here and elsewhere online, I formatted our outputText for Currency using the following: <apex:outputText value="{0, number, currency}"> <apex:param value=&...
user avatar
0 votes
1 answer
220 views

Converting Date/Time to Dates in reporting?

I have a report I'm running where one of the columns is Case CreatedDate, which defaults to a DateTime format like 9/10/2021, 11:44 AM. Is there a way to apply formatting to this so it could show in ...
user avatar
0 votes
0 answers
51 views

Editing the rich text field breaks the formatting

Within the screen flow we are using a custom "inputrichtextfsc" component where we are passing a classic e-mail template with formatting. This is the e-mail template (just for an example): ...
user avatar
  • 1
0 votes
1 answer
222 views

lightning-formatted-time with only HH:MM

Trying to display the Time in LWC component by using lightning-formatted-time, by default it print HH:MM:SS I would like to print only HH:MM <lightning-formatted-time value={stime.Start_Time__c}>...
user avatar
1 vote
2 answers
107 views

How to make VScode auto fix missing semicolons Apex?

Hey does anyone here know how to make VSCode auto fix missing semicolons instead of just show where it is missing? I Started setting up Prettier and it will format apex code but not replace double ...
user avatar
  • 191
0 votes
0 answers
18 views

Format lzo (audience studio)

In my integration with Audience Studio, I need send my string (csv) to lzo format How can you compress (apex code) a string in csv format to a lzo format? Thanks, Regards
user avatar
  • 138
1 vote
0 answers
597 views

Lightning Web Component 'lightning-input-rich-text' Change Font Size

I have a lightning-input-rich-text (LWC) in which I'd like to change the default text size from 12 to 10. On following the instructions in https://developer.salesforce.com/docs/component-library/...
user avatar
1 vote
1 answer
504 views

LWC Datatable percent data alignment off

So I've tried both of the solutions posted here: Lightning datatable column value misaligned and neither of them are working for what I have. The column above is the only sortable column in the ...
user avatar
0 votes
1 answer
62 views

Shorten zipcode in email using ampscript?

The data extension I'm working with has a zipcode field that, for some people, populates the 5-digit zipcode and for others it has the additional 4 digits. Is there a way with ampscript that I can ...
user avatar
  • 1
0 votes
0 answers
500 views

Lightning Web Component datatable - date time formatting

I'm creating a LWC with datatable that shows some of the key record values. I have just one issue - regarding the date/time formatting. For some reason, the field is shown as: My goal is to show it ...
user avatar
  • 139
3 votes
1 answer
676 views

Prettier errors out when formatting Apex classes

I have prettier and prettier-plugin-apex node modules installed. Formatting LWC and JSON works fine with prettier but get the below error when formatting Apex files. Never had this issue on my old ...
user avatar
  • 405
2 votes
0 answers
29 views

1 in superscript converts to tt

I'm trying to add '1' in superscript to input: but '1' is displayed as a 'tt' What is the way to add '1' in superscript to be shown properly?
user avatar
0 votes
1 answer
122 views

Left align currency symbol but right align the number in LWC [closed]

Is there any way to Left align currency symbol but right align the number in LWC? Example: $    2500.38 $      127.63 $        99.01
user avatar
  • 1,305
1 vote
0 answers
44 views

Salesforce record to Excel

So I'm trying to build a Visualforce page that takes some data from an individual record, displays it in a table and populates the appropriate fields, as well as leaving some fields empty, and exports ...
user avatar
0 votes
1 answer
265 views

LWC Datatable values formatting

Below is an image of standard account history related list and another one that I am trying to replicate. I am not sure how to get the field label from Field from AccountHistory. Also, how to go about ...
user avatar
  • 41
0 votes
0 answers
150 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....
user avatar
4 votes
2 answers
417 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 ...
user avatar
  • 1,099
0 votes
1 answer
195 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 ...
user avatar
0 votes
1 answer
141 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 = ...
user avatar
2 votes
2 answers
653 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 ...
user avatar
  • 383
6 votes
1 answer
3k 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 ...
user avatar
  • 129k
1 vote
2 answers
449 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 ...
user avatar
0 votes
1 answer
118 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'...
user avatar
  • 1
1 vote
2 answers
759 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(...
user avatar
5 votes
1 answer
480 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 ...
user avatar
  • 129k
1 vote
1 answer
879 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.
user avatar
  • 1,155
0 votes
0 answers
62 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....
user avatar
0 votes
1 answer
180 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 ...
user avatar
1 vote
1 answer
411 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 ...
user avatar
1 vote
1 answer
355 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 ...
user avatar
  • 694
0 votes
0 answers
1k 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, ...
user avatar
0 votes
1 answer
106 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 ...
user avatar
  • 160
1 vote
1 answer
499 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 ...
user avatar
3 votes
0 answers
111 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 ...
user avatar
  • 724
1 vote
1 answer
131 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 ...
user avatar
  • 59
9 votes
1 answer
3k 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 ...
user avatar
0 votes
1 answer
130 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 ...
user avatar
  • 385
-3 votes
2 answers
6k 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 ...
user avatar
  • 5
0 votes
1 answer
121 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, ###,###,###,###}...
user avatar
  • 355
1 vote
1 answer
166 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'...
user avatar
1 vote
1 answer
335 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 ...
user avatar
0 votes
2 answers
1k 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 ...
user avatar
2 votes
2 answers
5k 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 ...
user avatar
  • 3,167
1 vote
1 answer
2k 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 ...
user avatar
0 votes
1 answer
2k 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 ...
user avatar
  • 15
1 vote
2 answers
7k 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 ...
user avatar
1 vote
2 answers
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 ...
user avatar
  • 543