Activity Forums Salesforce® Discussions How to differ between rollup-summary and formula fields using APEX Schema functions?

  • Avnish Yadav

    Member
    July 20, 2018 at 12:58 pm

    Hello Chanchal,

    Roll up summary field can only be defined on the master object, i.e master in the master-detail relationship, while your formula fields calculate values using fields within a single record. And roll-up summary fields calculate values from a set of related records, such as those in a related list, like contacts in Account.

    Thanks.

  • Parul

    Member
    September 15, 2018 at 8:09 am

    A Rollup Summary field is used to calculate the sum of a fields in the child object record. It is compulsory to be in a Master-Detail relationship to use the rollup summary. Where as formula field is mostly used for calculations with in acertain object. And it is child to Parent.

     

    Thanks

  • shariq

    Member
    September 16, 2018 at 10:22 am

    Hi,

    When you describe a Rollup Summary Field, its describe returns null when you call getCalculatedFormula(), unlike a Formula Field.

    system.assertEquals(null, rollupDescribe.getCalculatedFormula());
    system.assertNotEquals(null, formulaDescribe.getCalculatedFormula());

    Hope this helps.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos