show count on the dashlet of any entitiy

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Maryam123
    Junior Member
    • Apr 2020
    • 19

    show count on the dashlet of any entitiy

    i want to show the count fo any entity based on the any condition . after some reserch found this:
    record\count('Call', 'accountId=', accountId) == 10

    but i dont understand how to use it in the dashlet , to show count .
    i have made the custom dashlet , please help me

    here is the screenshot attached
  • telecastg
    Active Community Member
    • Jun 2018
    • 907

    #2
    Hi,

    I am currently working with dashlets and will try to help.

    The sample code that you saw is a formula command.
    record\count('Call', 'accountId=', accountId) == 10
    Formula is a facility that allows you to create beforeSave hooks from the GUI (without actually coding) and its also used for workflows and BPM but not sure how to apply it for dashlets. You can learn about formula here: https://docs.espocrm.com/administrat...a/#recordcount

    Please post the following scripts for your custom dashlet:

    1) Dashlet json specs: (eg. custom/Espo/Custom/Resources/metadata/dashlets/{{YourDashletName}}.json), this is the script where you define the dashlet and its parameters.

    2) Dashlet custom view: (eg. client/custom/src/views/dashlets/your-dashlet-name.js), this is the view class that will actually render the dashlet

    3) Dashlet custom template (eg. client/res/templates/dashlets/your-dashlet-name.tpl) the template for the custom dashlet
    Last edited by telecastg; 08-20-2020, 06:02 PM.

    Comment

  • Maryam123
    Junior Member
    • Apr 2020
    • 19

    #3
    I agree with you my question is where do i perform the formula or calculations to count calI based on acceptence status , lets i have defined enum in the json file , but where do i need add formula in view ? want to show calls count based on the acceptence status , and return values to templete ,
    Last edited by Maryam123; 08-23-2020, 06:56 AM.

    Comment


    • telecastg
      telecastg commented
      Editing a comment
      Made a late edit, please read the post
  • Maryam123
    Junior Member
    • Apr 2020
    • 19

    #4
    tarasm yuri please help me a little how can i add total count to dashlet ,response will highly appreciated

    Comment

    • Maryam123
      Junior Member
      • Apr 2020
      • 19

      #5
      telecastg

      here is my client/src/views/dashlet/new.js //code​​​​​​
      Espo.define('views/dashlets/new','Views.Record.List', function (Dep) { return Dep.extend({ name: 'new', scope: 'Call', template: "client/custom/res/templates/dashlets/new", data:function () { return{ testMessage: "Welcome to Espo" } }

      Comment

      • Maryam123
        Junior Member
        • Apr 2020
        • 19

        #6
        this is client/custom/res/templates/dashlets/new.tpl




        <div class="row" style="margin-top: 50px;"> <div class="col-xl-3 col-lg-6 col-12" style="width: 25%!important;"> <div class="card pull-up"> <div class="card-content"> <div class="card-body"> <div class="media d-flex"> <div class="media-body text-left"> <h3 class="warning">{{{testMessage}}}</h3> <h6>Total Tentative Calls</h6> </div> <div> <span class="fas fa-phone warning font-large-2 float-right"></span> </div> </div> <div class="progress progress-sm mt-1 mb-0 box-shadow-2"> <div class="progress-bar bg-gradient-x-warning" role="progressbar" style="width: 65%" aria-valuenow="65" aria-valuemin="0" aria-valuemax="100"></div> </div> </div> </div> </div> </div> <div class="col-xl-3 col-lg-6 col-12"> <div class="card pull-up"> <div class="card-content"> <div class="card-body"> <div class="media d-flex"> <div class="media-body text-left"> <h3 class="accept">48</h3> <h6>Total Answered Calls</h6> </div> <div> <span class="fas fa-phone accept font-large-2 float-right"></span> </div> </div> <div class="progress progress-sm mt-1 mb-0 box-shadow-2"> <div class="progress-bar bg-gradient-x-success" role="progressbar" style="width: 65%" aria-valuenow="65" aria-valuemin="0" aria-valuemax="100"></div> </div> </div> </div> </div> </div> <div class="col-xl-3 col-lg-6 col-12"> <div class="card pull-up"> <div class="card-content"> <div class="card-body"> <div class="media d-flex"> <div class="media-body text-left"> <h3 class="danger">7</h3> <h6>Total UnAnswered Calls</h6> </div> <div> <span class="fas fa-phone-slash danger font-large-2 float-right"></span> </div> </div> <div class="progress progress-sm mt-1 mb-0 box-shadow-2"> <div class="progress-bar bg-gradient-x-danger" role="progressbar" style="width: 65%" aria-valuenow="65" aria-valuemin="0" aria-valuemax="100"></div> </div> </div> </div> </div> </div> <div class="col-xl-3 col-lg-6 col-12"> <div class="card pull-up"> <div class="card-content"> <div class="card-body"> <div class="media d-flex"> <div class="media-body text-left"> <h3 class="info">78</h3> <h6>Total Calls</h6> </div> <div> <span class="fas fa-phone info font-large-2 float-right"></span> </div> </div> <div class="progress progress-sm mt-1 mb-0 box-shadow-2"> <div class="progress-bar bg-gradient-x-info" role="progressbar" style="width: 65%" aria-valuenow="65" aria-valuemin="0" aria-valuemax="100"></div> </div> </div> </div> </div> </div> </div>





        and custom resource/metadata/dasjlets/new.json



        { "view":"custom:views/dashlets/new", "aclScope": "Call", "entityType": "Call", "options": { "fields": { "title": { "type": "varchar", "required": true }, "autorefreshInterval": { "type": "enumFloat", "options": [0, 0.5, 1, 2, 5, 10] }, "displayRecords": { "type": "enumInt", "options": [3,4,5,7,10,15,20,30] }, "displayCount": { "type": "Int" }, "expandedLayout": { "type": "base", "view": "views/dashlets/fields/records/expanded-layout" } }, "defaults": { "displayRecords": 5, "populateAssignedUser": true, "expandedLayout": { "rows": [ [ { "name": "name", "link": true } ] ] } }, "layout": [ { "rows": [ [ {"name": "title"} ], [ {"name": "displayRecords"}, {"name": "autorefreshInterval"} ], [ {"name": "expandedLayout"}, false ] ] } ] } }

        Comment

        • telecastg
          Active Community Member
          • Jun 2018
          • 907

          #7
          I created a new free extension to handle rendering dashlets similar to yours.

          You can check it out here: https://forum.espocrm.com/forum/deve...side-a-dashlet
          Last edited by telecastg; 09-23-2020, 05:09 PM.

          Comment


          • Maryam123
            Maryam123 commented
            Editing a comment
            hy hope you are doing well my issue was resolved ,
            perfect thanks for sharing ,
            currently im trying to add additional field in call popup my fied type is enum, but it is showing as the text box

          • telecastg
            telecastg commented
            Editing a comment
            Hi,

            Hope you are doing well too. I'm glad that you were able to resolve your issue.

            If you have a chance please post the solution, this will help other participants and will help making this forum a better tool.

            Cheers
        • Maryam123
          Junior Member
          • Apr 2020
          • 19

          #8
          telecastg i.ll share solution for sure . have you familiar with call popup in espocrm . my target is to add additional field in popup . im able to add text field but enum drop down is not adding

          Comment

          • telecastg
            Active Community Member
            • Jun 2018
            • 907

            #9
            I'm sorry, I am not familiar with call popup. We don't use espocrm for calls in our business (rental properties)

            Comment

            Working...