0

Hi everyone I am new to salesforce, I have a requirement which says that when an opportunity is created I want to populate a custom close date field with the last date of that quarter according to create date.

for example - Create date - 2/10/2022 month/day/year Custom formula field date - 3/31/2022 month/day/year

I hope you understand what I am trying to say, please anyone help me on this.

1

1 Answer 1

0

Yes - I think you can create a custom formula field, and the formula would look something like this:

CASE(CEILING( MONTH ( {!$Record.Creation_Date__c} ) / 3 ), 1, DATE(YEAR({!$Record.Creation_Date__c}), 03,31), 2, DATE(YEAR({!$Record.Creation_Date__c}), 06,30), 3, DATE(YEAR({!$Record.Creation_Date__c}), 09,30), 4, DATE(YEAR({!$Record.Creation_Date__c}), 12,31), NULL)

You will need to replace the creation_date field with however it is named in your org. Please let me know if this works.

6
  • I am getting an error while doing this
    – Zain Khan
    Commented Feb 11, 2022 at 7:24
  • Error: Incorrect parameter type for function 'MONTH()'. Expected Date, received DateTime
    – Zain Khan
    Commented Feb 11, 2022 at 7:24
  • I am using standard field CreateDate
    – Zain Khan
    Commented Feb 11, 2022 at 7:25
  • CASE( CEILING( MONTH( CreatedDate )/3 ) , 1, DATE( YEAR( CreatedDate ),03,31) , 2, DATE(YEAR(CreatedDate), 06,30), 3, DATE(YEAR(CreatedDate), 09,30), 4, DATE(YEAR(CreatedDate), 12,31), NULL)
    – Zain Khan
    Commented Feb 11, 2022 at 7:26
  • Thanks, it worked, I didn't use DateValue Functionality to convert the Date/Time field to Date Field. Finally, it is done, thankyou brother.
    – Zain Khan
    Commented Feb 11, 2022 at 11:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .