Skip to main content

#Formula Help0 discussing

I am trying to create a formula field to capture the 18-digit ID for the related account from a Task or Event. I have created the formula but I keep getting the error:

Error: Incorrect parameter type for function 'OR()'. Expected Boolean, received Text

 

Here is the formula I have: 

 | OR(

 IF(

     BEGINS(WhatId, "001"), 

     CASESAFEID(WhatId), 

     NULL

 ),

 IF(

     BEGINS(WhatId, "003"), 

    CASESAFEID(Contact__r.AccountId),

     NULL

 ),

 IF(

     BEGINS(WhatId, "006"), 

     CASESAFEID( Opportunity__r.AccountId), 

     NULL

 )

 )

Thank you for any help!

 

Marshall

 

#Formula Help  #Formulas

3 answers
  1. Nov 26, 2024, 9:44 AM

    Hello@Marshall Priest,

    Please try,

    IF(

    BEGINS(WhatId, "001"), CASESAFEID(WhatId),

    IF(

    BEGINS(WhatId, "003"), CASESAFEID(Contact__r.AccountId),

    IF(

    BEGINS(WhatId, "006"), CASESAFEID( Opportunity__r.AccountId),

    NULL

    )

    )

    )

0/9000

📣📡 Advanced Salesforce Formulas – Example

Salesforce Formulas are a powerful tool within the Salesforce platform, designed to enhance the functionality and interactivity of your Salesforce  applications. These formulas allow users to perform calculations, manipulate text, and automate processes, thereby transforming data into actionable insights. They are akin to the formulas used in spreadsheet  applications but tailored for Salesforce’s robust CRM environment. By utilizing Salesforce Formulas, administrators and developers can create dynamic fields, validation rules, and workflows that respond intelligently to user input and data changes. This capability not only streamlines operations but also ensures data integrity and enhances the user experience. Whether you are calculating sales commissions, formatting dates, or validating data entries, Salesforce Formulas offer a versatile and indispensable resource for maximizing the efficiency and effectiveness of your Salesforce instance.

Now today, I am going to share some of the advanced formulas which you might need to write during your implementation. I will always keep on updating this blog post as I encounter any such advanced formulas.

📒 https://sudipta-deb.in/2024/07/advanced-salesforce-formulas-example.html

 

📣📡 Advanced Salesforce Formulas – ExampleSalesforce Formulas are a powerful tool within the Salesforce platform, designed to enhance the functionality and interactivity of your Salesforce applicatio

@The Blog Group

 

#Formulas  #Formula Help  #Flow Formula

0/9000

📣📡 Commonly Used Salesforce Formulas – Good To Know

Salesforce Formulas are a powerful tool within the Salesforce platform, designed to enhance the functionality and interactivity of your Salesforce  applications. These formulas allow users to perform calculations, manipulate text, and automate processes, thereby transforming data into actionable insights. They are akin to the formulas used in spreadsheet  applications but tailored for Salesforce’s robust CRM environment. By utilizing Salesforce Formulas, administrators and developers can create dynamic fields, validation rules, and workflows that respond intelligently to user input and data changes. This capability not only streamlines operations but also ensures data integrity and enhances the user experience. Whether you are calculating sales commissions, formatting dates, or validating data entries, Salesforce Formulas offer a versatile and indispensable resource for maximizing the efficiency and effectiveness of your Salesforce instance.

In this blog post, I will share some of the most commonly used formulas. I will try to keep this blog post up to date by posting new formulas as I experience it in future.

📒 https://sudipta-deb.in/2024/07/commonly-used-salesforce-formulas-good-to-know.html

 

@The Blog Group📣📡 Commonly Used Salesforce Formulas – Good To KnowSalesforce Formulas are a powerful tool within the Salesforce platform, designed to enhance the functionality and interactivity of your Salesforce

 

#Formulas #Formula Help #Flow Formula

0/9000

Need help with formula:

We have a validation on the LinkedIn field that allows only in this format: 

https://www.linkedin.com/in/example...

Here is the formula currently in the validation:

NOT (REGEX( LinkedIn_Username__c, "^(http|https)://

www.linkedin.com/in/([a-zA-Z0-9_!@#$&()\\-.+]+)

")),

FALSE

 

Now we need to stripe out the validation of anything after 

linkedin.com

 

I tried removing this part but it didn’t work:

 

in/([a-zA-Z0-9_!@#$&()

\\-.+]+)

 

Please help!

#Formula Help

 

#Salesforce Admin #Formulas #Validation Rule

5 comments
  1. Eric Burté (DEVOTEAM) Forum Ambassador
    Jun 1, 2024, 7:13 AM
    Ana, please try in your formula to replace, in the linkedin base url part, only the in by (in|company). Eric
0/9000

Need help with a formula to calculate months for current year revenue. 

Here’s what I have: 

IF(

    YEAR(First_Day_of_Messaging__c) = YEAR(TODAY()),

IF(

 (MONTH(First_Day_of_Messaging__c)  < Length_of_Contract__c ) , 12 - MONTH( First_Day_of_Messaging__c ),Length_of_Contract__c ),

 0

    )

Works the majority of the time.  Here’s example of one issue where this doesn’t work:

First day of messaging:  May 24, 2024

Length of Contract: 6 (months)

With my formula, I’m getting 7, which is greater than the length of contract.

What I need in a formula is:

IF(MONTH(First_Day_of_Messaging__c) <  Length_of_Contract__c, 

12-MONTH(First_Day_of_Messaging__c) unless (12-MONTH(First_Day_of_Messaging__c) is more than the length of contract, Then just give me the Length of contract

I have no idea how to get that last part in bold included in my formula.  Would greatly appreciate any help!

 

#Formula Help

2 answers
  1. Mar 21, 2024, 6:46 PM

    Thanks @Nitika Jain, but now I'm getting 0 when the MONTH(First_Day_of_Messaging__c) is > than the Length_of_Contract__c.  

    Need this to use the Length of Contract (and not be 0). 

    Thanks so much.

0/9000

Hi All, 

 

I had created a formula to avoid when an opportunity is created with a past due close date that looks like this: CloseDate < TODAY()

 

It works most of the time. But the issue comes in when the order ( which is closed) needs to be updated or have final documents attached to the opportunity;  Salesforce will not allow the change to the closed order without changing the CLOSE DATE which I do not want to do.

 

How can I changed the formula to indicate that upon creation of the opportunity, the close date must equal or be greater than today's day. 

 

thank you for your help, 

 

Rochelle 

 

#Formula Help

2 answers
  1. Steven Trumble (Strum Consulting) Forum Ambassador
    Mar 6, 2024, 8:35 PM

    I assume you mean a validation rule and not a formula field. 

     

    AND(

    CloseDate < TODAY(),

    ISNEW()

    )

0/9000

Hi,

I'm looking to see a custom formula amount on a report for a custom object.

I have the custom formula created and it is showing only at the subtotal/total level.

 

We have a cumulative capacity number by month and 3 utilities that it will break out between. Each utility has a pre-determined amount and I want to multiply the cumulative monthly capacity by this field (it has a default %, but there is also a picklist of %'s users could override with). Can anyone assist with getting this in each monthly row, not just a grand total?

 

I've tried to do this by the default amount and also by the field in the formula but all are only showing as a total, not on a monthly view. As you can see in the screenshots below we're just getting a total, not in each row and also the formula to calculate i.e PG&E value.

This should be the cumulative capacity * 0.49 (it is defaulted as 49% and just trying to get the formula to work via this field as opposed to a set number)

Showing row level amount with custom formula

 

Screenshot 2024-02-28 at 12.44.19 PM.png

 

Thanks in advance! 

 

#Reports & Dashboards  #Formulas  #Formula Help  #Reports

8 answers
0/9000

I have a field that is Completion_date_Quarter__C and it is a text field that returns Q1, Q2, Q3, Q4 depending on the date something was billed.  I am trying to create a summary formula that calculates revenue per quarter. For example i want a column for the sum of the revenue for each quarter.   I have tried the following: 

 

IF(Lane__c.Completion_Date_Quarter__c = "Q1", Lane__c.Revenue_Less_FSC__c, 0)  

it is telling me that my Completion_Date_Quarter__C does not exist as a field.  

 

Below is the error it is giving:

 

Invalid custom summary formula definition: Field Lane__c.Completion_Date_Quarter__c does not exist. Check spelling.

 

#Formulas  #Formula Help  #Reports

6 answers
  1. Eric Praud (Activ8 Solar Energies) Forum Ambassador
    Feb 29, 2024, 5:15 PM

    Hi Jessica,

     

    You could simply group your report by the quarter and add the revenue field to your report. It should summarise automatically. If it doesn't, click on the arrow on the Revenue column> Summarize> Sum

0/9000

I am looking to create a field that shows the Current Year Revenue  as well as a field to show the Previous Year's revenue on the account object that relates to a revenue field in a custom object.  I am wanting to see what the previous year's revenue is and the current year's revenue.  Is there a formula using the YEAR function that can calculate that? 

 

#Formula Help

3 answers
  1. Bradley Weller (Fast Slow Motion) Forum Ambassador
    Feb 28, 2024, 2:35 PM

    Any solution I can think of would require either a custom rollup tool or Flow.

     

    You could create two custom fields on the child object. The first would be a number field to capture the current Calendar Year. You could set the default value on new records to YEAR(TODAY()), but you would need a scheduled Flow to run on the first of each year to update all of the values to the new current year.

     

    The second field would compare that YEAR value to the YEAR value of your custom Date field. That formula would look similar to below.

     

    IF(!ISBLANK(Date__c),

    CASE(This_Year__c - YEAR(Date__c),

    0, 'This Year',

    1, 'Last Year',

    'Other Year')

    , 'No Date Entered')

    You could make the text for values outside of this year and last year whatever you want by modifying what I have as Other Year. You could also evaluate additional years such as -1 for next year, 2 for two years ago, etc...

     

    You can then reference this formula field in the filter conditions of your Roll-Up Summary. Because TODAY()'s date changing does not trigger an update to records, you cannot directly reference TODAY() or NOW() in a formula field used as a Roll-Up Summary filter.

0/9000

I have a field for sales reps that is a picklist value I need this to pull on reports for contacts but it gives me error or use picklist value. The referral partners are a field inside of the contacts and the contact type specific to the referrals need to group by this value. 

 

I tried 

 

IF(ISPICKVAL(FastrakCRM_FC__Referred_by__r.Builder_Contact_Type__c)= "Builder Sales Rep"), "Builder Sales Rep")

 

but it reads I need to remove a coma. 

 

#Formula Help

7 answers
  1. Feb 27, 2024, 3:51 PM

    Personally I'm a big fan of the CASE Function when it comes to Picklist Fields

    CASE(FastrakCRM_FC__Referred_by__r.Builder_Contact_Type__c,

    'Builder Sales Rep', 'Builder Sales Rep',

    NULL)

    TEXT is also one of my Go-To Functions

     

    IF(

    TEXT(FastrakCRM_FC__Referred_by__r.Builder_Contact_Type__c) ='Builder Sales Rep', 'Builder Sales Rep',

    NULL)

0/9000