Add a onw action to a list-view in a customer entity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sttn
    Member
    • Apr 2020
    • 38

    #1

    Add a onw action to a list-view in a customer entity

    Hello,

    I search a way to add a own action to this dropdown-list.
    Click image for larger version

Name:	image.png
Views:	21
Size:	20.7 KB
ID:	119687

    I find nothing in the documetnation, does someone have an idea?

    Attached Files
  • heint
    Junior Member
    • Jun 2025
    • 13

    #2
    Greetings, sttn,
    What kind of action do you want to implement there? Maybe we can recommend you a better workaround for this case. Because it seems like you can't adjust those types of dropdown lists without adding custom code solutions.

    Comment

    • sttn
      Member
      • Apr 2020
      • 38

      #3
      Hi Heint,
      behind the rows there are some processes, so there are some actions:
      - change Status
      - cancel execution, but don't delete

      It should start an custom API action.

      I found for Meetings a good excemple:
      Click image for larger version

Name:	image.png
Views:	12
Size:	25.4 KB
ID:	119705

      And I found the Javascript where Espo add it to Meeting: client/modules/crm/src/views/meeting/record/row-actions/default.js

      But when I implement it for my own entity, it does not work.

      Comment

      • yuri
        Member
        • Mar 2014
        • 9178

        #4
        You need also to define in metadata. https://docs.espocrm.com/development...#rowactionlist

        You can use the meetings action as an example.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment


        • sttn
          sttn commented
          Editing a comment
          Thank you!
      • sttn
        Member
        • Apr 2020
        • 38

        #5
        Now, I test it and it works greate.

        I use a custom entity with the name "CSms".

        In custom/Espo/Custom/Resources/metadata/clientDefs/CSms.json:

        Code:
        "rowActionDefs": {
             "cancelSMS": {
             "label": "SMS Canceln",
             "handler": "custom:cancelSMS",
             "acl": "edit" }
             },
        "rowActionList": [
                  "__APPEND__",
                  "cancelSMS"
             ]
        And that is the handler (client/custom/src/cancelSMS.js):
        Code:
        define('custom:cancelSMS', ['action-handler'], (Dep) => {
             return class extends Dep {
        
                  /*
        ​          Execute, when selected
        ​          */
        ​          process(data, e) {
                       console.log("cancelSMS.process");
        
        ​          ​     // Debugging ... so you can see what you get in "data" and "e"
                       console.log("data:");
                       console.log(data);
                       console.log("e:");
                       console.log(e);
                  }
        
                 /*
                 Check, if it should bee available
                 This is called, when the menu is created.
                 If it returns false, the menu item will not be shown.
                 If it returns true, the menu item will be shown.
                 */​
                  isAvailable(data) {
                       console.log("cancelSMS.isAvailable");
        
        ​          ​     // Debugging ... so you can see what you get in "data"
        ​               console.log("data:");
                       console.log(data);
        
                       return true;
                  }
             }
        });​
        After "Clear Cache" + "Rebuild":
        Click image for larger version

Name:	image.png
Views:	10
Size:	15.8 KB
ID:	119717
        Last edited by sttn; Yesterday, 08:03 AM.

        Comment

        Working...