Announcement

Collapse
No announcement yet.

Creating Custom Buttons (with custom actions)

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

  • Creating Custom Buttons (with custom actions)

    Hi Yuri!

    I want to customize my EspoCRM, i want to generate some specific reports por some custom Entities. My question is how can i create a button which calls a new window (calling an specific PHP document) and display the info that i need to print. Is it possible?

  • #2
    Yes, it's possible. You have to add to your view detail.js file the code:
    Code:
    this.menu.actions.push({
        'label': 'Custom Action',
        'action': 'customAction',
        'acl': 'edit'
    });
    Example you find in the file client/modules/crm/src/views/call/detail.js
    Job Offers and Requests

    Comment


    • #3
      You can do it also in metadata > clientDefs.

      Example:
      application/Espo/Modules/Crm/Resources/metadata/clientDefs/Campaign.json
      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


      • #4
        Thank you! Both options worked fine!

        Comment


        • #5
          Hi there!

          As suggested above, I have added my custom button to my custom.json for detail. Button shown OK and goes to target (in my case my custom pdf entity)

          is there any easy way to pass parameters to target like ; detail": {"buttons": [
          ...........
          "link": "#Pdf?ent={entityType}&entid=
          {entityId}",

          Thanks in advance,

          Selcuk


          Comment


          • #6
            You need to create action in js view file. You can take Email 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


            • #7
              How can I make button link to: " tel: {AccountName} " ?

              Comment


              • #8
                guys..could you guys give me the code to create the custom button please. its been a week i trying all by myself.

                Comment


                • #9
                  It would be good to have a complete example. Maybe a tutorial.

                  Comment


                  • #10
                    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


                    • #11
                      I tried the example and it does not work with Version 5.8.3. I cleen the cache, reload the page etc...

                      Comment


                      • #12
                        I get following error in the debugger from Chrome:

                        VM7991:257 Uncaught (in promise) TypeError: Cannot read property 'forEach' of undefined
                        at child.eval (eval at _execute (loader.js:94), <anonymous>:257:30)
                        at Array.forEach (<anonymous>)
                        at child.showHeaderActionItem (eval at _execute (loader.js:94), <anonymous>:256:48)
                        at child.controlButtonVisibility (eval at _execute (loader.js:94), <anonymous>:22:27)
                        at child.initSomeName (eval at _execute (loader.js:94), <anonymous>:12:18)
                        at eval (eval at _execute (loader.js:94), <anonymous>:78:60)
                        at Espo.Loader.load (loader.js:292)
                        at Espo.Loader.require (loader.js:154)
                        at root.require.Espo.require (loader.js:423)
                        at eval (eval at _execute (loader.js:94), <anonymous>:76:29)

                        Comment


                        • #13
                          I also have followed the documentation example and get the same error as sttn when viewing any record that has the button hidden due to the status. If the status of the record allows for the button to be shown then everything works fine, however if the button is hidden then there is the JS error. TypeError: Cannot read property 'forEach' of undefined

                          I commented the code inside the controlButtonVisibility function and was able to continue working. Any help on how to avoid the error when hiding the button would be appreciated.

                          Comment


                          • #14
                            Debug client/src/views/main.js showHeaderActionItem. For some reason you have property 'menu' defined in a wrong way. Could be that you messed it in metadata > clientDefs.
                            Last edited by yuri; 06-16-2020, 02:30 PM.
                            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

                            Working...
                            X