Announcement

Collapse
No announcement yet.

possibility to show sum of related entity records in another entity field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • possibility to show sum of related entity records in another entity field

    Hi,

    Is there any possibility to show sum of related entity records in another entity field ?


    eg:

    Entities - Gifts & Opportunities
    Fields in gifts - total gifts value
    Fields in opportunities - gift amount


    Simply I want to show the total sum from the opportunities gift amounts in Gifts total gifts value field.

    I have created below sum related under gifts


    totalGiftsValue = entity\sumRelated('opportunities', 'giftAmount');


    Bu the record update as 0.

    Please correct me or help me if I do anything wrongly.
    Cheers!
    Nishan.

  • #2
    Hi,
    the formula looks good.
    1. Check an EspoCRM log file for possible error description;
    2. Make sure that the 'giftAmount' field does not equal to '0'.

    Comment


    • #3
      Hi max,

      Thanks for your reply. I tried and no error found. Isn't this working with Relationships ?? Im trying with relationship. Any idea.
      Cheers!
      Nishan.

      Comment


      • #4
        It should work with a relationship. Can you provide a screenshot of your Gifts & Opportunities settings?
        Last edited by Maximus; 05-14-2020, 07:30 AM.

        Comment


        • #5
          Hi Max,

          This is the one I tried in demo site. please check let me know if I did wrongly.
          Cheers!
          Nishan.

          Comment


          • #6
            Maximus I change the formula as this
            Code:
            totalGiftsValue = entity\sumRelated('opportunity', 'opportunity.giftAmount');
            and I got value is 0

            Cheers!
            Nishan.

            Comment


            • #7
              I've investigated your screenshots and on my mind totalGiftsValue = entity\sumRelated('opportunities', 'giftAmount'); is the correct formula. Set it for the Gifts entity and recalculate formula for the 'test 1' record. Also, check please whether the 'totalGiftsValue' and 'giftAmount' are proper key values.

              Comment


              • #8
                Hi Maximus I got it work. I did my mistake in the link that i have to gave. I put entity name instead of link name. This works with the below.


                totalGiftsValue = entity\sumRelated('opportunities', 'opportunity.giftAmount');



                Thanks for the support max.
                Cheers!
                Nishan.

                Comment

                Working...
                X