4

Start and End Dates need to be calculated date fields (formula) based on the Fiscal_Year_Start_Date__c field on the Account and the Fiscal_Year__c.
Example: If Fiscal_Year__c = 2013 and Account.Fiscal_Year_Start_Date__c = 7/1/1990, Start Date = 7/1/2013 and End Date = 6/30/2014

Fiscal_Year__c is of type Picklist Fiscal_Year_Start_Date__c is Formula field

4

How about as a start.

startDate:

DATE(VALUE(TEXT(Fiscal_Year__c)),MONTH(Fiscal_Year_Start_Date__c),DAY(Fiscal_Year_Start_Date__c))

endDate is a bit more problematic in a formula field. In Apex you could just do a addDays(-1) to get the EndDate and cleanly roll around months and years. In a formula field you are probably going to need a combination of CASE, IF and MOD statements.

You might be able to do some arithmetic based on 1440 being the number of hours is a day, but I haven't tried it yet.

See Adding Days, Months, and Years to a Date

I haven't tried it, but maybe the following will work.

DATE(VALUE(TEXT(Fiscal_Year__c)),MONTH(Fiscal_Year_Start_Date__c),DAY(Fiscal_Year_Start_Date__c)) - 1
| improve this answer | |
  • Fiscal_Year__c is a field type of picklist – sfdc Dec 5 '13 at 20:55
  • @sf.dev I've added VALUE() to the formula to convert the picklist value to a number. – Daniel Ballinger Dec 5 '13 at 20:58
  • I am getting an error .Error: Field Fiscal_Year__c is a picklist field. Picklist fields are only supported in certain functions. – sfdc Dec 5 '13 at 21:18
  • 1
    @sf.dev might need to convert it to text first. I'll update the answer. – Daniel Ballinger Dec 5 '13 at 21:20
  • @DanielBallinger Great Work, Can you help me to resolve my question salesforce.stackexchange.com/questions/237892/… – Ragul Oct 31 '18 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.