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
Dee511Dee511 

I would like to return a date value if a field is blank

I am not great with formulas. However, I am trying to write a formula that would return today's date if the contract sold date is blank on the page layout. I have not yet been able to accomplish this.  Can someone assist?   Something like - IF(Contract_Sold_Date__c = NULL, Contract_Sold_Date__c = 'CreatedDate')
 
AbhinavAbhinav (Salesforce Developers) 
Hi Dee,

Did you mean based on Contract_Sold_Date__c is null or not you want to returns today's date to formula field?
 
Maharajan CMaharajan C
Hi Dee,

If you are looking to populate the Contract_Sold_Date__c with today date if it is blank then use the workflow field update:

1. Setup => Build => Create=> Workflows&Approvals => Workflow Rules => New Rule => Select your Object.
2. Fill the rule name
3. Evaluation Criteria => Evaluate the rule when a record is:   created, and every time it's edited
4. Rule Criteria => Run this rule if the =>  formula evaluates to true.
5. use ISBLANK(Contract_Sold_Date__c ) in formula editor.
6. Save & Next
7. Immediate Workflow Actions => Add Workflow Action => New Field Update => Fill the Name.
8. Field to Update => Contract_Sold_Date__c.
9. Specify New Field Value => Use a formula to set the new value => enter the formula as  TODAY()  => Save => Done => Activate.


Or If you are looking to create a new the formula field to display the today date if Contract_Sold_Date__c is blank then Create a new custom Formula field in Object and use the below formula:
 
IF(ISBLANK(Contract_Sold_Date__c ) , TODAY() , Null)

Thanks,
Maharajan.C
Dee511Dee511
@Abhinav  yes.  looking to return todays date  
AbhinavAbhinav (Salesforce Developers) 
Okay...I think @Maharajan has provided solution for both scenario.It seem fine to me.

Have you tried that?
Suraj Tripathi 47Suraj Tripathi 47

Hi,

Use this formula in place of your code. IF(Contract_Sold_Date__c = NULL, Contract_Sold_Date__c = 'CreatedDate')

IF(ISBLANK(Contract_Sold_Date__c ) , TODAY() , Null)
Thank You