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
RuduRudu 

Lightning component which calculates real time

Hi Guys,
I'm trying to build a lightning component which calculates real time.
I want Calculate TimeSpan__c(Number data type) field on Account object on the basis of Account (Execute_datetime__c) field and picklist value of metal(Metal__c)
Formula field for the same.
if(
AND (
$CustomMetadata.Metal_Setting__mdt.1ML.Metal__c = TEXT(Metal__c),
($CustomMetadata.Metal_Setting__mdt.1ML.SLA_Length__c - Floor((Now() - Execute_datetime__c) * 24 * 60) > -700)
),
$CustomMetadata.Metal_Setting__mdt.1ML.SLA_Length__c - Floor((Now() - Execute_datetime__c) * 24 * 60),
-700
)

Custom metadata type Metal
Metal      Legnth
Platinium 20
Silver    10

But due to some formula field limitation i want another solution to calculate TimeSpan__c field.
I can do the same thing using Apex trigger but issue is update field on Insert and update operation(Trigger event).
Its not reflect real time in this field.
Can you please give me the any suggestion or any lightning component functionality example to achive this.
Note:(Fields calcates real time data like counter) 
Any help would be appreciated!! 

Thanks
Ridu
RituSharmaRituSharma
Instead of creating a field(formula or editable), you may directly show in lightning component by writing formula over there.
RuduRudu
Hi Ritu,
Can you please provide reference for lightning component.
Thanks