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
Hari.gsHari.gs 

Formula field

Hi,

 

I would like to create a new custom field on my object Account, say Customer Age and it should be a Number field

 

The field should show the result of TODAY (current date) minus the oldest Purchased Product Date.

 

in SOQL we can write this a

 

AggregateResult[] puchasedProd = [select min(Purchase_Date__c)Purchase_Date__c from Purchased_Products_del__c where Account__c=:id];
Customer Age = puchasedProd[0].get('Purchase_Date__c').daysBetween(NOW());

 

Is this possible to do this calculation in a Formula field instead of using a trigger?

 

Thanks and Regards

Hari G S