Count Related with Condition

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abhilash.kumar.niit
    Member
    • Sep 2024
    • 82

    Count Related with Condition

    Hi i want to count related records with some conditions like "Critical = True" and status = "Open"

    i am aware that i can do it using the filter report , but i am curious that can i achieve this without using the report filters as well??? if Yes please suggest .
  • Vadym
    Super Moderator
    • Jun 2021
    • 353

    #2
    Hi abhilash.kumar.niit

    You can try to realize the desired by using Formula:


    Last edited by Vadym; 09-20-2024, 08:21 AM.

    Comment

    • victor
      Active Community Member
      • Aug 2022
      • 853

      #3
      For example,
      Code:
      $opportunitiesCount = record\count('Opportunity', 'accountId=', id, 'critical=', true, 'status=', 'Open');
      This formula must be inserted into Administration > Entity Manager > Formula > Before Save Custom Script.

      Comment

      • abhilash.kumar.niit
        Member
        • Sep 2024
        • 82

        #4
        Hi victor, Thanks for the reply . i am aware of this solution but when i apply the conditions in formula it is giving error of "
        No primary filter 'status=' for 'CQualityAuditFormParameter'.​"

        Comment


        • victor
          victor commented
          Editing a comment
          I gave you a formula that fits the query you described in the first post of this thread. I have also tested this formula before recommending it to you. You should read the above documentation in detail, and in the record\count example, check the field types included in this formula.
          You can also show the community your formula and screenshots of the field settings you use.
          Last edited by victor; 09-24-2024, 09:24 AM.
      • abhilash.kumar.niit
        Member
        • Sep 2024
        • 82

        #5
        Hi i have applied this formula but this needs to edit and save the record. is there any possible way where it should be updated on page load instead of edit and save the record?

        Comment

        • victor
          Active Community Member
          • Aug 2022
          • 853

          #6
          The admin can run Recalculate Formula action for specific records from the list view: select records (or all search results) > click Actions dropdown > click Recalculate Formula.

          Comment

          • abhilash.kumar.niit
            Member
            • Sep 2024
            • 82

            #7
            can i do this calculation on page load ? is there any possible way?

            Comment


            • victor
              victor commented
              Editing a comment
              For new formulas everything will work as you described, but for old ones you need to Recalculate Formula. For all records using Mass Update this is done in a minute at most, even faster.
          Working...