I have created custom fields Days_In_2010__c, Days_In_2011__c, Days_In_2012__c, Days_In_2013__c, Days_In_2014__c, Days_In_2015__c, Days_In_2016__c, Days_In_2017__c, Days_In_2018__c, Days_In_2019__c, Days_In_2020__c, Days_In_2021__c, Days_In_2022__c, Days_In_2024__c, Days_In_2023__c, Days_In_2025__c, Days_In_2026__c, Days_In_2027__c, Days_In_2029__c, Days_In_2028__c, Days_In_2030__c, TotalDays__c which basically hold days value for that perticular year based on start date and enxpiration date.
if start date= 8/1/2019 and ExpirationDate= 7/31/2021, Then only these fields should updated and remaining field should set to 0
Days_In_2019__c= 153
Days_In_2020__c= 366
Days_In_2021__c=212
TotalDays__c=731.
is there any way without coding where i can achieve this ?
5 risposte
Hi,
++Ankush , but I would make one change for the Year field. I wouldn't make it a picklist field, just a standard text or number field that would be populated by the flow so there is never a need to update the picklist values.If you really want to use the fields on the same object, they need to be formula fields like so (I'll take 2010 as an example, you'll need to change the year in the formula to the same year as the field and change "365" to "366" for leap years). This will only work if both start and end date are not in the same year:
IF(AND(YEAR(StartDate__c)<2010,YEAR(EndDate__c)>2010), 365,
IF(YEAR(StartDate__c)=2010, DATE(2010,12,31)-StartDate__c,
IF(YEAR(EndDate__c)=2010, EndDate__c-DATE(2010,1,1),
NULL)))