Add Tasks to Product entity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jakub
    Junior Member
    • Mar 2021
    • 27

    Add Tasks to Product entity

    Is it possible to add Tasks side panel to Product entity?
  • DEN
    Senior Member
    • Apr 2021
    • 106

    #2
    Hello,
    I think it is possible to do this by the following workaround:

    Step 1, Create Relationship.
    Administration >Entity Manager >Product>Relationships>Many-to-Many>Tasks, check the box 'Link Multiple Field';
    Step 2, Add this field to the layout.
    Administration >Entity Manager >Product>Layouts> Side Pannel Fields.

    Comment

    • Jakub
      Junior Member
      • Mar 2021
      • 27

      #3
      Thank you, it is possible, but I would like to know if there is standard way to enable it.

      Comment

      • Maximus
        Senior Member
        • Nov 2018
        • 2731

        #4
        Hi Jakub,
        What do you mean under the 'standard way'?

        Anyway, if you want the Task's side panel to look like in the Contact entity, then you need to add it via the code.

        Comment

        • Jakub
          Junior Member
          • Mar 2021
          • 27

          #5
          Ok, that is the answer. The "standard way" is it look like in contact entity. Thank you

          Comment

          • Maximus
            Senior Member
            • Nov 2018
            • 2731

            #6
            Tips on your "standard way" request:
            1. Create the file /custom/Espo/Custom/Resources/metadata/clientDefs/Product.json:
            Code:
            {
                "sidePanels": {
                    "detail": [
                        {
                            "name": "tasks",
                            "label": "Tasks",
                            "view": "crm:views/record/panels/tasks",
                            "aclScope": "Task"
                        }
                    ]
                }
            }
            2. In the file /custom/Espo/Custom/Resources/metadata/entityDefs/Product.json add a link to the Task:
            Code:
            {
                "fields": {
                    //possible custom fields description
                },
                "links": {
                    "tasks": {
                        "type": "hasChildren",
                        "entity": "Task",
                        "foreign": "parent",
                        "layoutRelationshipsDisabled": true
                    }
                }
            }
            3. Administration -> Clear Cache
            4. Reload a web page

            Perhaps you will also need to open Administration -> Entity Manager -> Taks -> Relationship -> Children-to-Parent relationship -> Edit -> add Products to the Parent Entity Types scope/

            Comment

            • Jakub
              Junior Member
              • Mar 2021
              • 27

              #7
              Great, thank you, works perfect.

              Comment

              Working...