Announcement

Collapse
No announcement yet.

Triggering a custom button service

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

  • Triggering a custom button service

    I found this thread regarding custom buttons, but it isn't clear to me at all. I am hoping to find a very simple guide about how to add a new button and then where to put the server side code to run the code associated with the button.

    The goal is to do this as simply as possible. Editing javascript files seems harder than it should be, so I would like to avoid that. Yuri's comment (#3) in the other link suggests this should be possible in the metadata/clientDef json file. Here's the example he linked:

    Code:
      1 {
      2     "controller": "controllers/record",
      3     "menu": {
      4         "list": {
      5             "buttons": [
      6                 {
      7                     "label": "Target Lists",
      8                     "link": "#TargetList",
      9                     "acl": "read",
     10                     "style": "default",
     11                     "aclScope": "TargetList"
     12                 }
     13             ],
     14             "dropdown": [
     15                 {
     16                     "label": "Mass Emails",
     17                     "link": "#MassEmail",
     18                     "acl": "read",
     19                     "aclScope": "MassEmail"
     20                 },
     21                 {
     22                     "label": "Email Templates",
     23                     "link": "#EmailTemplate",
     24                     "acl": "read",
     25                     "aclScope": "EmailTemplate"
     26                 }
     27             ]
     28         }
     29     },
    The problem is I don't understand what any of that means or how it should be used. There are no guides as far as I can tell. I want to do something really simple: click a button and have it run a section of PHP code that will update the associated entity's status.

    It would be great if the button could also be hidden based on the status of the entity. For example, if the status is currently 'Open' and you want it to be 'Submitted', the Submit button should be shown. If the status is already Submitted, then the button should be hidden. Is this possible? If so, would it be possible to get a simple and complete tutorial? I've seen this question asked many times and there's never a complete answer. Answering it completely in one place would probably prevent a lot of questions in the future.

  • #2
    Had a similar situation and managed to create a custom action button which calls a custom service. Check the post, it has a sample of the code and where it is located within EspoCRM.

    I am using entry point "pdf" to generate a a "lease" document based on a record view of my custom "Tenancy" entity but I would like to be able to use the full css capabilities for positioning, fonts, background images, etc instead of being very limited by TCPDF css capabilities. One possible


    Hope it helps

    Cheers

    Comment


    • #3
      I hope you add the button
      Example of changing of field value

      Comment

      Working...
      X