Skip to main content
5 votes
Accepted

If Statement with complex logic

Errata After looking at the edit to the question, it seems like the issue is that the "merge field" parts improperly contained the comparison. {!$Record.SBQQ__PrimaryQuote__r....
Derek F's user avatar
  • 62.4k
5 votes
Accepted

How to find first Monday from given date?

The primary reason for that is that your formula is currently, literally being told to start from the first of the month /* v This right here */ DATE(...
Derek F's user avatar
  • 62.4k
5 votes
Accepted

How to write a formula to match a month prior to today's date with a date field on the contact

All of the details of handling dates (and there are a lot more details than most people realize) are handled automatically when using ADDMONTHS() and also when adding/subtracting a number of days, e.g....
Derek F's user avatar
  • 62.4k
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.4k
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

what mistake am I doing here

You can't subtract a time from a date or date/time. Instead, you can subtract a number, which is in number of days, so want to divide by 24 to represent the number of hours to offset by. ...
sfdcfox's user avatar
  • 495k
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.4k
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

Tilde Error in Formula

Surround the tilde in either single or double quotes. "Smart" quotes (i.e. “ ” or ‘ ’) will not work Strings and single characters need to be enclosed in quotes. Otherwise the formula tries ...
Derek F's user avatar
  • 62.4k
2 votes

Need help on converting an excel financial formula to apex code

The portion of the expression (ResidualValue/((1+(3%/12))^Term)) you have coded as (residualValue / Math.pow((d1), d2) but d2 = term -i and the excel formula wants simply term so you need (...
cropredy's user avatar
  • 71.9k
2 votes
Accepted

Multiple If statement with Picklist values

You'd place the next if statement where the last null is right now. However, since we're here, we may as well optimize the rest of the formula, too. We can make it far more legible by doing this: IF( ...
sfdcfox's user avatar
  • 495k
2 votes
Accepted

Syntax error. Missing ')'

The error you're getting is misleading. There are two main issues with your attempt. Picklist and Multipicklist fields can't appear on their own. You need to use a function like TEXT() or ISPICKVAL()....
Derek F's user avatar
  • 62.4k
2 votes
Accepted

IF statement in HTML Template Giving blank output

Classic templates (text, HTML, custom) do not support formulas. They're specifically called "merge fields" for a reason. Instead, use a Visualforce template, which does support formulas. ...
sfdcfox's user avatar
  • 495k
2 votes
Accepted

Calculate the number of quarters two dates span across

From the excel docs: YEARFRAC will return the number of days between two dates as a year fraction, in decimal form If you substract 2 dates in Salesforce formulas, it will give you the number of ...
Guy Clairbois's user avatar
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
1 vote

Capture name of user who updated field

I would recommend setting up Field History Tracking on the field you want to track. This will show which user updated the field you are tracking. If you need it in a field for reports, you could use a ...
fred's user avatar
  • 3,420
1 vote

Extracting a text using formula between two elements

I hope I understand the exact challenge raised by your question. The following suggestion is ultimately created via the field formula editor and only once tested in a Flow, but on the basis of an ...
Felix van Hove's user avatar
1 vote
Accepted

Vlocity Data Raptor - CONCAT Function Issue

The formula you've used is correct. I was able to achieve the expected concatenated output by mapping the formula output to a new key "Result" in the same Info list. Please refer the ...
Swapnil Rawat's user avatar
1 vote
Accepted

Mystery Error Message For Flow Entry Criteria Formula

This appears to be a Salesforce Flow Limitation - Relayed from another question - "This is because Formulas in entry criteria that use Formula fields involving traversals are currently not ...
KB2021's user avatar
  • 83
1 vote

Help adding to formula

Comparisons can't be chained like what you've tried /* this is wrong */ texcellency__DefHC_NumEmployees__c OR custom_number_field__c < 2749 Instead, you need to do each comparison explicitly. You ...
Derek F's user avatar
  • 62.4k
1 vote

Validation Rule for specific text values

When you're checking if a single field is not equal to any of a collection of possibilities, you need to use AND() instead of OR() That's because if the value is, say, "STATE" then it can't ...
Derek F's user avatar
  • 62.4k
1 vote

Validation rule to prevent field change

You should write a formula for the negative cases, not for the right one. The validation rule should be triggered when MainBrand__c has been changed and either MainBrand__pr.WebsiteRelevant__c or ...
RubenDG's user avatar
  • 8,592
1 vote

Formula field to define FCR met or Not Met

You're not using ISPICKVAL() correctly. Taking a look at the documentation for ISPICKVAL(), you'll see that it takes 2 parameters: the picklist field, and the value you want to check. Note that you ...
Derek F's user avatar
  • 62.4k
1 vote

Why am I getting this error when I sue the solution posted for how to use a picklist field in a formula field

Because VALUE() takes a string and turns it into a number, and string + string + number makes no sense as a formula (i.e. it's a syntax error). The + operator in functions can be used for both string ...
Derek F's user avatar
  • 62.4k
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

How to detect Formula Expressions exposing vulnerable information like session id?

That's not a vulnerability, simply an example of how formulas can be used. Later in the paragraph, they state that if you allow editable, unescaped values into your code, you can introduce ...
sfdcfox's user avatar
  • 495k
1 vote

Creating a due date formula based on case types with different working days

The actual problem is missing commas. Sometimes the syntax checker gets confused by missing commas and thinks you missed a closing parenthesis instead. You are also missing a couple of inner CASE ...
Jason Clark's user avatar
  • 11.9k
1 vote

Creating a due date formula based on case types with different working days

You can try this: CASE(WEEKDAY(DATEVALUE(CreatedDate)), 1, CASE(Type, "Multiple queries", DATEVALUE(CreatedDate) + 12, "Legacy", DATEVALUE(CreatedDate) + 40, ...
Tushar Jadav's user avatar
  • 2,049
1 vote

Multiple If Statements on a HTML Email Template

Email templates are pretty dodgy. Try just defining that same calc as a formula field and using that, eg Plan_Cost__c: IF(WorkOrder.Plan_Name__c = "$84 Naked FibreClassic", "84", ...
Caspar Harmer's user avatar
1 vote
Accepted

Is it possible to use an object field as part of regex rule?

Use the String Concatenation ("&") operator: NOT(REGEX(FIELD, State & "-[0-9]{4}"))
sfdcfox's user avatar
  • 495k

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