function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mallorywoodmallorywood 

Formula to populate a date

Hello,

 

I'd like to create a formula for a new custom field titled "Launch Date." This formula must populate a date that is exactly 21 weeks past a date I am manually entering into a different custom field titled "Due Date."

 

For example: I enter 5/22/12 as the Due Date and my Launch Date field automatically fills in with 10/16/12.

 

I've never worked with Salesforce formulas before and will appreciate any help given.

 

Best,

Mallory

Best Answer chosen by Admin (Salesforce Developers) 
johnc82johnc82

I don't think you have Launch Date setup as a Formula field.  You may have it setup as a Data field, that's why you see default value.

 

You need the field type as Formula, then select Date as the Formula Return Type.

 

You can't change that field to a formula field either.  You'll need to delete it and create a new field to get it.

All Answers

johnc82johnc82

Try this.

 

Due Date__c + (7*21)

mallorywoodmallorywood

John, I imagine that would work. However, I am getting an error message: Due_Date_c may not be used in this type of formula.

 

:smileysad:

johnc82johnc82

What is the API name of the Due Date field you're wanting to use? If the label is Due Date, try Due_Date__c.  That's 2 underscores between Date and c.

mallorywoodmallorywood

Yes, same error when I use two underscores. I think I mistyped in my last message.

 

When I show the formula editor, the custom field "Due Date" isn't even an option. That might be why that error message is generated.

johnc82johnc82

I was under the impression that you already had the field created to capture the date.  If you want Launch Date to be a formula and show the date 21 weeks from a date entered in a field called Due Date, the correct formula for the Launch Date field would be Due Date__c + (7*21) assuming you didnt change any API names.  You have to create the Due Date field or whatever you want to call it that will capture the user entered date, then create the formula date field.

mallorywoodmallorywood

Yes, both custom fields are already created, no API's have been altered, and I've entered the information exactly as you recommended.

 

I am entering this information into the "Launch Date" formula field, which I access in "Opportunity fields" > Edit > General Options >Default Value 

johnc82johnc82

I don't think you have Launch Date setup as a Formula field.  You may have it setup as a Data field, that's why you see default value.

 

You need the field type as Formula, then select Date as the Formula Return Type.

 

You can't change that field to a formula field either.  You'll need to delete it and create a new field to get it.

This was selected as the best answer