Skip to main content
I need help with figuring some dates. I have a field on the custom child object of the Asset labeled "Date". I also have two other fields labeled "Starting Period" and "Ending Period". I have a picklist on the Asset object labeled "Billing Frequency". Based on the Billing Frequency selection (Annually, Quarterly, Monthly, One-time), I want to update the Starting Period and Ending Period fields. ( ex. "Date" 2/1/2015 "Billing Frequency" Monthly)

 

This is what I have but it doesn't work when the Billing Frequency is Annually. Only working with Quarterly.

 

Starting Period current formula:

 

DATE( year(Date__c) + floor((month(Date__c) + 2 )/12) + if(and(month(Date__c)=12,2>=12),-1,0)

 

,

 

if( mod( month(Date__c) + 2 , 12 ) = 0, 12 , mod( month(Date__c) + 2 , 12 ))

 

,

 

min( day(Date__c),

 

case(

 

max( mod( month(Date__c) + 2 , 12 ) , 1),

 

9,30,

 

4,30,

 

6,30,

 

11,30,

 

2,28,

 

31

 

)

 

)

 

)

 

Ending Period current formula:

 

DATE( year(Date__c ) + floor((month(Date__c) + Asset__r.Months_Duration__c + 2 )/12) + if(and(month(Date__c)=12,Asset__r.Months_Duration__c + 2>=12),-1,0)

 

,

 

if( mod( month(Date__c) + Asset__r.Months_Duration__c + 2, 12 ) = 0, 12 , mod( month(Date__c) + Asset__r.Months_Duration__c + 2 , 12 ))

 

,

 

min( day(Date__c),

 

case(

 

max( mod( month(Date__c) + Asset__r.Months_Duration__c + 2, 12 ) , 1),

 

9,30,

 

4,30,

 

6,30,

 

11,30,

 

2,28,

 

31

 

)

 

)

 

)
1 risposta
0/9000