Skip to main content
5 votes

profile.name = "System Adminstrator" in formula field is not working

The approach of checking profile names for disabling validation or determining other conditional behaviour has never been a good choice, and becomes less and less appropriate as Salesforce moves ...
Phil W's user avatar
  • 36.8k
4 votes

Date Format to have Month as Text

When debugging formulas, the first thing you should always do is to format it according to best practice. tl;dr: Put parts of formulas/functions on separate lines, and indent an extra level when you ...
Derek F's user avatar
  • 62.3k
3 votes

Date Format to have Month as Text

& TEXT(Day(DATEVALUE(fHCM2__E_End_Date__c)) & "," Is missing a ) near the end. Consider getting a syntax highlighter-enabled text editor, like VS Code, to make it easier to find ...
sfdcfox's user avatar
  • 495k
3 votes
Accepted

Cannot create formula using lookup object?

Formulas can reference data from higher in a hierarchy, but not lower. You can reference data on a parent record, a grandparent, etc... going up to a maximum of 5 levels. You cannot reference child ...
Derek F's user avatar
  • 62.3k
2 votes

I need to create / automatically display an age rounded to the nearest half year. My formula is only giving me to the year

I think going at this from a year/month/day approach (like you're currently using) is the wrong way to go about this. I'm sure you could make it work, but I imagine that the resulting formula would be ...
Derek F's user avatar
  • 62.3k
2 votes
Accepted

How keep these 2 logics in one IF statement formula?

Calling back to your previous question, the opposite of SBQQ__NetAmount__c <= 7500 is SBQQ__NetAmount__c > 7500. Those two conditions cover every possible number. So while your formula is ...
Derek F's user avatar
  • 62.3k
2 votes
Accepted

Need to calculate Elapsed time between 2 Date time fields excluding weekends

Anything beyond the most simple of Date/time calculations are generally best done using Apex instead of formulas. That said, it does look like there are improvements that you can make here. Swapping ...
Derek F's user avatar
  • 62.3k
2 votes

Formula to populate a field if closed date is blank

You can use the ISBLANK function to check if the case has a closed date or not. The ISBLANK function returns TRUE if the expression is blank, and FALSE otherwise. You can use this function to create a ...
Tushar Jadav's user avatar
  • 2,049
2 votes
Accepted

Why does the same field seem to have 2 different API names, one with __c and one with __pc?

The field is Contact_Id__c when querying a contact, and Contact_Id__pc when querying an account. This is because the field is on the Contact object, which gets mirrored as __pc on the Account.
sfdcfox's user avatar
  • 495k
2 votes
Accepted

Help capturing days in each stage of Opportunity

While it is technically possible to do this with formulas, I think you're really getting into "you should do this in Apex" territory. To completely handle all scenarios, you'd need to be ...
Derek F's user avatar
  • 62.3k
1 vote
Accepted

Formatting field value (string) as JSON in Flow - Error: The formula expression is invalid: Syntax error. Extra '"SampleJSON"'

A valid JSON takes the following form - { "fieldName": "value" } If you are trying to create a JSON String, you need to wrap the JSON object in single quotes '{ "...
Wes Lyons's user avatar
  • 336
1 vote
Accepted

Issue with address field in formula

The then and else parameters of an IF() must be the same datatype. From some brief experimenting, it looks like Salesforce is treating Address fields (a type of compound field) as a Location, and ...
Derek F's user avatar
  • 62.3k
1 vote
Accepted

Formula field syntax exceeds character length limit

Counting how many fields are not blank is definitely a superior approach to enumerating every possible combination of non-blank fields. The CASE() approach is fine, but now that I take a look at it, ...
Derek F's user avatar
  • 62.3k
1 vote

Formula field syntax exceeds character length limit

After re-working the formula from @Phip W suggestion, I vastly reduced the number of characters. Here is the improved formula for reference to others encountering a similar issue: CASE( IF(ISBLANK(...
user1718612's user avatar
1 vote
Accepted

Help with Formula Field - IF & LEFT Functions

The issue you're hitting here is that with the order in which you're evaluating the values, the first check for 'Certificate I' is always going to be true for the other values. To fix this, you could ...
Callum MacErlich's user avatar
1 vote
Accepted

Update a field based on another field

You need to have a total of an even number of parameters. The first parameter is the value to check against, then pairs of values and outputs, and a final value that is the default value. You ...
sfdcfox's user avatar
  • 495k
1 vote
Accepted

restrict Formula field value to refresh on selection of certain picklist items

Formulas don't store data. They are calculated on the fly every time the record is queried. You need to use a normal field and then use an automation, such as a Flow or Apex Trigger, to store the ...
sfdcfox's user avatar
  • 495k
1 vote
Accepted

Where is the official documentation for how the "$Permission" field type functions in Formula Fields?

One place you can see the documentation for $Permission (and other Global variables) is in the Visualforce Developer Guide $Permission page $Permission A global merge field type to use when ...
cropredy's user avatar
  • 71.9k
1 vote
Accepted

IF Statement I want the value to show as a Percent

Yes there is. You just have to do some more processing to Discount_Percentage__c multiply it by 100 then convert it to text then append the '%' symbol you can append two strings in a formula using ...
Derek F's user avatar
  • 62.3k
1 vote

How to create a Roll up summary field, activity on leads

The Declarative Lookup Rollup Summary Tool (dlrs for short) is the workaround that you're looking for. It was originally created by Andrew Fawcett, but control was given to the Salesforce.org Open ...
Derek F's user avatar
  • 62.3k
1 vote
Accepted

Formula Field with Custom Metadata Type that is created in test method

CMDT isn't regular data. It's metadata. And like most metadata, it's actually available directly to the unit test, even without SeeAllData=true. Apex doesn't have a way to create actual CMDT records ...
sfdcfox's user avatar
  • 495k
1 vote

Salesforce - How to compare two Date/Time fields?

This strikes me as an odd way to use the CASE() function. I think the issue here is that you're trying to make a "dynamic formula". Something where the actual formula isn't known until "...
Derek F's user avatar
  • 62.3k
1 vote
Accepted

Sort list/kanban view by integer formula field

Yes, it is possible to do this. Here is my Account List View sorted by Days Old (a Number formula field):
fred's user avatar
  • 3,420
1 vote
Accepted

Phone Number Formating using Formula field

You can try this: IF( LEFT(Phone, 1) = "+", RIGHT(SUBSTITUTE(Phone , " ", ""), 11), IF(LEFT(Phone, 1) = "0", "61" & RIGHT(...
Tushar Jadav's user avatar
  • 2,049
1 vote

Calculate the Case age based on changed status

Unfortunately a formula isn't going to work for you here, so a single field isn't going to support this requirement. I've managed this in one of two ways before: As you've noted in your question, ...
Callum MacErlich's user avatar
1 vote

Nested IF THEN Statement

Like the error is telling you, IF() only accepts 3 parameters. If you look at the documentation, IF() looks like IF(condition, value if true, value if false) When you nest IF() functions in a formula,...
Derek F's user avatar
  • 62.3k
1 vote

Error: Incorrect parameter type for TEXT. Expected Number, Date, DateTime, received Picklist

as mentioned below the formula editor box: Use formula syntax: Enclose text and picklist value API names in double quotes : ("the_text"). You can use this in your formula box. "$User....
prem22's user avatar
  • 662

Only top scored, non community-wiki answers of a minimum length are eligible