Questions tagged [formatting]

About formatting data such as String, Datetime, etc.

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

Does SOQL.FORMAT() always return the same formatted string as getFieldDisplayValue()?

Does SOQL.FORMAT() always return the same locally formatted string that getFieldDisplayValue() would? In lightning/uiRecordApi, there are two methods for getting the value of a field from a record: ...
  • 201
0 votes
1 answer
34 views

Having issues with handling text field

I have one requirement where text field have information like below format: String name = 'email,phone(Jason),mobile,address(Mason)'; Now what I want to do is create a Map<Key, List<String>&...
1 vote
1 answer
57 views

Apex Code Formatter for SOQL

I want SOQL fields should be in the same line, not every field goes to a new line, Current : Expected : SELECT Field1, Field1, Field1, Field1,.... FROM Object WHERE ... .prettierrc { "...
  • 978
1 vote
1 answer
163 views

Vertical Alignment of Button in Grid Column

In my Lightning Grid one of the columns contains an Input Field and the one next to it contains a button. Ideally I would like the button icon to align vertically with the input field and horizontally ...
-1 votes
1 answer
200 views

Screen flow format decimal places

I have a screen flow that is displaying a currency field from an object with two decimal places. The problem is that if the decimal part is .00, it is completely dropping the decimal places. Below is ...
  • 97
-1 votes
1 answer
278 views

Change the CreatedDate format in Apex

I have the following apex code that displays the created date of records: for(let i=0; i<emailMessages.length; i++){ replyBody += 'On '+ emailMessages[i].CreatedDate + ' ' + emailMessages[i]....
0 votes
1 answer
995 views

Use Salesforce Flow to check for a certain phone number format

As the title states I'm trying to check if my phone numbers are suitable to be converted to standard format (US only). Specifically, I want all 10 digit phone numbers that do not start with 1 and all ...
0 votes
1 answer
838 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 &...
1 vote
1 answer
3k 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 ...
  • 13
0 votes
1 answer
93 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 ...
0 votes
1 answer
2k 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 ...
0 votes
0 answers
208 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): ...
  • 1
0 votes
1 answer
872 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}>...
1 vote
2 answers
283 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 ...
  • 301
1 vote
0 answers
967 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/...
1 vote
1 answer
979 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 ...
0 votes
1 answer
101 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 ...
  • 1
0 votes
0 answers
1k 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 ...
  • 139
3 votes
1 answer
2k 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 ...
  • 465
2 votes
0 answers
31 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?
0 votes
1 answer
227 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
  • 1,315
1 vote
0 answers
84 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 ...
0 votes
1 answer
534 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 ...
  • 41
0 votes
0 answers
232 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
2 answers
625 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 ...
  • 1,231
0 votes
1 answer
364 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
1 answer
282 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 = ...
4 votes
2 answers
1k 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 ...
  • 413
6 votes
1 answer
5k 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 ...
  • 133k
1 vote
2 answers
721 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
1 answer
186 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'...
  • 13
1 vote
2 answers
2k 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
1 answer
703 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 ...
  • 133k
1 vote
1 answer
1k 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.
  • 1,237
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....
0 votes
1 answer
299 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
1 answer
934 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
1 answer
596 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 ...
  • 693
0 votes
0 answers
2k 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
1 answer
201 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 ...
  • 160
1 vote
1 answer
815 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
0 answers
171 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 ...
  • 724
1 vote
1 answer
360 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 ...
  • 69
11 votes
2 answers
4k 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
1 answer
234 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 ...
  • 361
-2 votes
2 answers
10k 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 ...
  • 15
0 votes
1 answer
289 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, ###,###,###,###}...
  • 355
1 vote
1 answer
254 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
1 answer
455 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 ...
2 votes
2 answers
2k 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 ...