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:
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.
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 },
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.
Comment