Announcement

Collapse
No announcement yet.

Server error when creating a dashlet

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

  • Server error when creating a dashlet

    I'm trying to create a dashlet to show Knowledge Base Articles from a certain category of articles. I've created dashlets before, usually without a hitch. However, with this, I'm getting this error:

    Code:
    Espo.ERROR: Uncaught Exception Error: "Class 'Espo\Services\NotFound' not found" at /var/www/html/espocrm/application/Espo/Services/Layout.php line 56 {"exception":"[object] (Error(code: 0): Class 'Espo\\Services\\NotFound' not found at /var/www/html/espocrm/application/Espo/Services/Layout.php:56)"} []
    This is my code in Custom/Resources/metadata/dashlets/KnowledgeBaseArticles.json

    Code:
    {
      "view":"views/dashlets/abstract/record-list",
      "entityType": "KnowledgeBaseArticle",
      "options": {
          "fields": {
              "title": {
                  "type": "varchar",
                  "required": true
              },
              "autorefreshInterval": {
                  "type": "enumFloat",
                  "options": [0, 0.5, 1, 2, 5, 10]
              },
              "displayRecords": {
                  "type": "enumInt",
                  "options": [5,10]
              }
          },
          "defaults": {
            "displayRecords": 5,
            "primary": "usingThePortalArticles"
          },
          "layout": [
              {
                  "rows": [
                      [
                          {"name": "title"},
                          {"name": "autorefreshInterval"}
                      ]
                  ]
              }
          ]
      }
    }
    If I remove the "entityType," no error, but also no info. It says "Please select your entity type." If I try a different entityType, I get the same server error.

    I don't think my view is the problem, but here it is:

    Code:
    define('custom:views/dashlets/knowledge-base-articles','views/dashlets/abstract/base',function (Dep) {
      return Dep.extend({
        name: 'Knowledge Base Articles',
        template: 'custom:dashlets/knowledge-base-articles'
      })
    });
    I'm sure I'm over-looking something dumb, but I can't see it :-/

    Thanks in advance for the help!

    PS. I've even tried stripping it down to the bare example from here: https://github.com/espocrm/documenta...e-a-dashlet.md and adding a basic entityType...it errors out.

  • #2
    Hi,

    I run into this old posting while working on a new dashlet.

    In case you haven't found a solution, I think that the problem is that you are missing a "expandedLayout" default value so Espo doesn't know what the layout of each record row should be like.

    I tested the following code and is working fine:

    custom/Espo/Custom/Resources/metadata/dashlets/KnowledgeBaseArticles.json
    Code:
    {
        "view":"views/dashlets/abstract/record-list",
        "entityType": "KnowledgeBaseArticle",
        "options": {
            "fields": {
                "title": {
                    "type": "varchar",
                    "required": true
                },
                "autorefreshInterval": {
                    "type": "enumFloat",
                    "options": [0, 0.5, 1, 2, 5, 10]
                },
                "displayRecords": {
                    "type": "enumInt",
                    "options": [5,10]
                },
                "expandedLayout": {
                    "type": "base",
                    "view": "views/dashlets/fields/records/expanded-layout"
                }
            },
            "defaults": {
                "displayRecords": 5,
                "expandedLayout": {
                    "rows": [
                        [
                            {
                                "name": "name",
                                "link": true
                            }
                        ],
                        [
                            {
                                "name": "status"
                            },
                            {
                                "name": "createdAt"
                            }
                        ]
                    ]
                },
                "searchData": {
                    "primary": "usingThePortalArticles"
                }
            },
            "layout": [
                {
                    "rows": [
                        [
                            {"name": "title"}
                        ],
                        [
                            {"name": "displayRecords"},
                            {"name": "autorefreshInterval"}
                        ],
                        [
                            {"name": "expandedLayout", "fullWidth": true}
                        ]
                    ]
                }
            ]
        }
    }
    custom/Espo/Custom/Resources/i18n/en_US/Global.json
    Code:
    {
        "dashlets": {
            "KnowledgeBaseArticles": "Knowledge Base Articles"
        }
    }

    Comment

    Working...
    X