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
shivangi shailesh 8shivangi shailesh 8 

Need to update formula field

Hi guys,plesae help me out with this scenario:
Here the  list view named of Object Sla_sanpshot__c who is a child of sla__c object.
In list view there is fields like A__c  AND B__c from Sla_snapshot__c so if i will update this fields then i want to change the value in my formula which is like (A/B)*100...SO writing trigger to update but it is throwning me an error:

    if(Trigger.isUpdate || Trigger.isInsert)
        for(SLA_Snapshot__c s:
            s.Formula__c  = s.Formula__c != null ? string.valueof(s.Formula__c) : '';
}User-added imageUser-added image
Nikhil Shah 14Nikhil Shah 14
Hi Shivangi, you cannot update formula fields..i.e., if the field type of the field that you are trying to update is formula, then you cannot update it any way like apex trigger or process builder or workflow rule.