• Sebastian Schwarz
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Recently I have tested ApexPages.StandardSetController method and used .save method and worked fine. However I have changed to add new Calculated fields and tried to use .RecalculateFormulas() available for sobject and I faced a message error:
Unable to create/update fields: <sobject>. Please check the security settings of this field and verify that it is read/write for your profile or permission set.
I think there is nothing regarding to this above once I just took out the .save() method and just invoked the recalculateFormulas(). If I just take out the master_detail_field from my query, it works.
Code sample below:
...
ApexPages.StandardSetController([SELECT id, name, Master_detail_Field__c FROM sobject])
...
        for(sobject s: setRecords.getrecords()){
            s.recalculateFormulas();
        }