Announcement

Collapse
No announcement yet.

custom button handler wrong filepath

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

  • custom button handler wrong filepath

    Hi, I'm trying to create custom button using this manual https://docs.espocrm.com/development...in-detail-view

    Following manual I've created button like this:

    Code:
    "detail": {
    "buttons": [
    "__APPEND__",
    {
    "label": "Uhradit",
    "name": "uhradit",
    "action": "uhradit",
    "acl": "edit",
    "data":{"handler":"custom:sales-order-action-handler"}
    ,
    "initFunction": "initManageSalesOrderAction"
    }
    ]
    }
    but the nginx error.log show me the error according to filepath:
    Code:
    [error] 31#31: *2730 open() "/var/www/html/client/custom/src/sales-order-action-handler.js" failed (2: No such file or directory), client: yy.yy.yyy.yy, server: xx.xx.xx.xx, request: "GET /client/custom/src/sales-order-action-handler.js?r=1650526176 HTTP/1.1", host: "xx.xx.xx.xx", referrer: "http://xx.xx.xx.xx/"
    so it's try to open file here /var/www/html/client/custom/src/sales-order-action-handler.js

    but the real directories structure looking like this:

    /var/www/espocrm/data/espocrm/client/src/sales-order-action-handler.js

    so, the question is:

    How can I change filepath here: data":{"handler":"custom:sales-order-action-handler"} ? or maybe you know another way to fix it?

    ps: adding the raw filepath to data: handler: not working
    Last edited by smartinsar; 04-21-2022, 09:04 AM.

  • #2
    The path should be client/custom/src/sales-order-action-handler.js and not data/espocrm/client/src/sales-order-action-handler.js.

    I believe whatever file is under data/ is a temp or a cache file. I maybe wrong.

    There is no need to add raw file path anywhere, ESPO should resolve the path on its own.

    Note that the define() part of the js file should have the same name as the file name and the name given under data: handler. And not forget to rebuild after making any change.

    Comment


    • #3
      Thank you

      Comment

      Working...
      X