Questions tagged [formula-field]

A formula field is a field that automatically calculates its value from other fields, expressions, or values.

Filter by
Sorted by
Tagged with
36 votes
1 answer
1k views

What are the compiled costs of each Formula function

Each formula function has a compiled cost that contributes towards the hard 5000 compiled character formula limit. What are the current compiled costs associated with each formula function?
4 votes
3 answers
16k views

Date Formula to Calculate date excluding weekends

I have a formula that is calculating the date from another date field + number of days and returning a date. test census dates field = Confirmed_Enrolled_Date__c + 16 I want to exclude weekends ...
  • 83
3 votes
5 answers
23k views

How to extract the time into a formula field?

I want to extract the time component of CreatedDate (standard field) into a formula field (which should be a string) that contains just the time part. So if CreatedDate is Jan 4, 2014 17:23:10, ...
  • 1,481
7 votes
4 answers
4k views

Why isn't OrderProduct TotalPrice standard field available in formula merge field list

I am trying to create a custom Formula field on the OrderProduct standard object that is new with the Spring 14 release. However, while the standard fields ListPrice & UnitPrice are available in ...
5 votes
2 answers
9k views

Formula field change doesn't cause trigger fire

Assume we have ObjectA__c with Field1__c and ObjectB__c with formula field Field2__c which is formula to ObjectA__r.Field1__c. I expected change of record field Field1__c of ObjectA__c would cause ...
  • 14.7k
3 votes
3 answers
3k views

Setting/mocking out formula fields during tests

We have an object (let's call it Child) with a formula field that does a lot of checking of various fields and spits out a numeric result (estimated number of days some work will take, based on a ...
  • 315
2 votes
5 answers
4k views

Formula field is too big to execute (5,480 characters)

I got an error when i am trying to add fomrula in formula field. Error: Compiled formula is too big to execute (5,480 characters). Maximum size is 5,000 characters My formula is (ED__c+...
2 votes
1 answer
3k views

Convert a number to its expression in words (e.g. 55 -> fifty-five)

Is there a way to convert a number to a string (Apex code, formula field ..) For example: 5200 > cinq milles deux cents
  • 635
1 vote
1 answer
3k views

Convert Number Values Into Time in formula field

I have formula field- Hours_Left__c=Budgeted_Hours__c - Billable_Hours__c Where I get Number value like- 8.70(Hours_Left__c) = 10.00(Budgeted_Hours__c )-1:30(Billable_Hours__c) Here I want 8:30 in ...
  • 147
1 vote
2 answers
6k views

How to get the all prior field value in textearea field or formula field

I have one text field like priority and I will change every day the priority. now I would like to store the prior values in the text area field or formula field. how to do? Temporary i am viewing the ...
  • 885
1 vote
2 answers
6k views

Formula Error: Syntax error. Extra ','

I am trying to write a formula for opportunities but I keep getting the following error Error: Syntax error. Extra ',' Here is my formula IF (TODAY() > CloseDate && TEXT(...
1 vote
4 answers
4k views

How do we capture the domain name from a url field in a formula

I am trying to get the capture just the domain name from a website field in Account in a formula field. For eg. if website is http://www.yahoo.com i need the formula field to display only yahoo. ...
  • 12.1k
1 vote
1 answer
615 views

I have a formula field. I need to display a certain value depending on the local time of the day [duplicate]

I have a formula field. The field should display a certain value depending on the local time of the day. For example, if it is between 9:00 and 12:00 - morning, 12:00 and 3:00 - afternoon, and so on. ...
1 vote
2 answers
2k views

how to calculate earliest leap year in formula field salesforce

I am writing a formula where I need a logic for calculating the earliest leap year. Formula (Sum(Mort1, Mort2, Mort3)*1.08^(current year-earliest LP year))+water+ECB+Taxes What logic we can apply ...
0 votes
2 answers
120 views

Formulae in workflows

I am trying to add the formulae in the workflow mentioned below: AND( ISCHANGED (Account.Name),OR( ( Account.Type = 'Client'))) but it shows the error as Error: The ISCHANGED function cannot ...
0 votes
2 answers
12k views

Formula syntax with multiple IF statements

I'm still very new to the formula syntax, and am hoping to achieve a series of nested IF statements. I'm a bit more experienced with bash, and what I'm trying to achieve would look something like this ...
0 votes
1 answer
447 views

How do I use a formula text field to display in a record whether a candidate has been approved or not, based off a checkbox?

I have a checkbox field named "Approval" that is checked and not checked when creating a candidate record to see if they have been approved. What I'm trying to do is create a formula text ...
0 votes
1 answer
2k views

Field is not writeable: CAM_Members__c.Affiliate_State__c

My compiler says that this field is not writeable: Field is not writeable: CAM_Members__c.Affiliate_State__c I have this class static testMethod void AffliateTest(){ SS_Data__c ns = new ...
0 votes
2 answers
10k views

Formula field - limit on a number of object references

I am trying to create a new field on "Case" but I get the following error: "You have reached the maximum number of 15 object references on Case. You must remove at least 6 relationships(s) in order to ...
-1 votes
1 answer
94 views

DATE formula issue

The below is a part of a formula that i wrote, everything is working fine, except for the below. My need is, if the " Renewal Month" field ( which is a month picklist field with values as January, ...
  • 158
14 votes
3 answers
11k views

Find line break in formula field

I noticed that the Contact.MailingStreet field can be accessed line-by-line in reports with the Mailing Address Line 1, Mailing Address Line 2, and Mailing Address Line 3 fields. I want to create ...
  • 6,119
12 votes
1 answer
2k views

Salesforce1 and HYPERLINK() showing raw html

Has anyone found a way to have a field, which is a formula field that uses HYPERLINK(), to display correctly in the Salesforce1 APP? Currently in the browser based Salesforce1 it functions correctly, ...
  • 53.6k
7 votes
4 answers
15k views

Formula field on parent object to get last related list record field

I'm trying to create a formula field on a parent object that will retrieve a field from the latest record in a child related list (without apex if possible). The related list is from a lookup field ...
  • 723
5 votes
2 answers
7k views

Counting multi-select picklist selections in a formula

I would like to ask something about FORMULAS. I have a multipick list field where the user select one or more options(text), i would like to count how many options he select and multiple that for one ...
  • 179
5 votes
2 answers
2k views

Can anyone help with a formula to pull an email address from a text string in a standard field?

I am trying to pull an email address from a text string in the standard "Description" field on Case object. The below formula is correctly pulling everything AFTER the "@" symbol in the email ...
  • 121
4 votes
2 answers
10k views

How can I use a formula field to retrieve a record in a lookup

I have created a lookup field between the Quote Line Items object and a custom Discounts object. I want to retrieve a certain discount dependent on discount code and product category. My Discounts ...
  • 723
4 votes
1 answer
1k views

recalculateFormulas() causing UnexpectedException: Unable to create/update fields: IsDeleted

When I update my custom Record__c a trigger runs, and it calls recalculateFormulas() on the record. This results in the following error: System.UnexpectedException: Unable to create/update fields: ...
  • 3,866
3 votes
2 answers
2k views

Multiple Checkboxes in Formula Field

I'm sorry if the title is completely butchering what I'm looking for, please let me know if should be updated. Here's what I'm struggling with: I have 11 checkboxes on an opp layout. I need the ...
3 votes
3 answers
21k views

formula field to display multi select picklist (selected values)

I have a Multi-select picklist in account object and I want to display the selected picklist values in contact object using a formula field. I came across many using multiple If conditions. In my ...
  • 511
3 votes
1 answer
4k views

How to query for formula fields in test classes

From what I understand, formula fields are calculated when a record is opened/read. If a record is created by a controller extension and then queried then it's never really opened or read, so ...
  • 636
3 votes
2 answers
115 views

Formula field using IF and CASE

I am trying to modify a formula field that we currently use that looks at a date (Date_Booked__c) and based on the MONTH and YEAR returns a text string along the lines of Q1-2017, Q2-2017, etc. We ...
3 votes
2 answers
13k views

How do we get user's time zone offset integer in Apex or Formula Field?

How do we get user's time zone offset integer in Apex or Formula Field? For example, a user's personal information time zone (GMT-04:00) Eastern Daylight Time (America/New_York) should return -4. ...
  • 4,592
3 votes
1 answer
4k views

Formula filed to display image, works in classic not in lightning

The below formula displays green red or yellow in the field based on the calculation. It works fine in classic view but not in Lightning. I read that as of Winter 15 images were not supported in ...
  • 121
3 votes
3 answers
771 views

Operator Precedence in formula field

I have formula field like this: 2*2^3 Result = 64 Expected Result = 16 - I am getting this result in excel I corrected the formula by adding parenthesis. My question is that exponentiation ...
  • 525
2 votes
2 answers
6k views

Can a formula field be indexed?

I have a formula field called ContactID18__c on the Account object. The formula is CASESAFEID(PersonContact.Id). Can this field be indexed or no because it is a custom field and a formula? Or is ...
2 votes
2 answers
974 views

Buttons with dynamic titles in formula Field Buttons?

Question Is there anyway to create an image for a button with a variable title for use in a formula field? Background A common request I get is to put buttons in the page layout itself as the ...
2 votes
3 answers
5k views

Excluding weekend and holidays from my days number

I want to retreive the weekend and holidays from my days number! I've created a formula field named weekend where I put : CASE(MOD( Start_date__c - DATE(1985,6,24),7), 0 , CASE( MOD( End_date__c - ...
  • 635
2 votes
1 answer
2k views

Giving formula values with multi-select picklist

I am trying to make a formula that will give values from a multi-select picklist and i want to know what is the fastest and cleanest way to do this? Video_Monetizing_tool__c != "No" to give a value ...
2 votes
1 answer
253 views

Critical Update: Trust Percent Values in Flow sObject Variables Again

When I go thorough this critical update's description it says, Previously, our calculations on percent values weren’t always working as expected. We rolled out a partial fix earlier, and this ...
2 votes
2 answers
1k views

Restrict Auto case-number field to specific record type

I've a custom auto case-number field for one of my case record type (Quality Report). Every time a new case is created, the auto case number is generated (ex: QR-1287). However, the auto number field ...
2 votes
2 answers
1k views

Formula for finding business days since last interaction

Trying to figure out why this formula is only returning a 1 or a 6. I am trying to figure out how many business days from when a case was created or from the last update. IF( ISBLANK(...
2 votes
2 answers
2k views

Help with Formula field IF

I am creating a Formula field that returns texts when: Picklist_Status = Activated, the return text should be A else null Picklist_Status = Sold, the return should be B else null Picklist_Status = ...
  • 33
2 votes
2 answers
3k views

Luhn algorithm check digit in formula field

I'm struggling with Luhn algorithm to calculate check digit for 14 digit length number. I found this solution here, hut it's only for 6 digit number. If I want to create it for more digits I'll get ...
  • 491
1 vote
1 answer
59 views

Field Formula for Soonest Date After X Amount of Days

I'm trying to create a couple of fields to calculate the eligibility date for employee benefits. -The first one should return a date of either the 1st or the 15th of the month 60 days after Hire Date. ...
  • 13
1 vote
3 answers
8k views

Difference between 2 DateTime fields in Hours and Minutes with timezones

I am having trouble in finding the difference between 2 datetime variables and reducing the offset timezone difference in order to get the local time from the salesforce generated GMT time. I have a ...
  • 605
1 vote
2 answers
851 views

Change a formula field and get Data Uniqueness Violation - The proposed data changes would violate a uniqueness constraint

Given Existing custom field Asset.SerialNumber (OOTB - Text) New custom field Asset.SerialNumber_bis__c (Text255, External Id non-unique, deterministic encrypted case insensitive) Existing custom ...
  • 66.6k
1 vote
1 answer
702 views

Javascript Hyperlink formula field

Is it possible to embed javascript in Hyperlink formula field to open a vf page in a pop up?Can you share the formula,if possible?
  • 301
1 vote
4 answers
722 views

Formula Field creation

I have created the Custom Field Field called DateTime1__c with type as (Date and Time) in order object. When creating record in object, if i give value for DateTime1__c field, then another custom ...
user avatar
1 vote
2 answers
3k views

How to pull SAML Federation ID into a Formula Field?

One of my custom objects have a relationship with User object. I need to pull SAML Federation ID (Field Name: FederationIdentifier) of User object into a formula field in the custom object through ...
1 vote
1 answer
3k views

How to convert text field number value to text in formula field?

I created input text field (money__c)value is 55995999. Where in this value, how to add commas using text formula field value like 5,59,95,999 Can anyone please guide?
  • 357