Announcement

Collapse
No announcement yet.

Creating a custom view/controller/route.

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

  • Creating a custom view/controller/route.

    Hello,
    I am trying to make a custom duplicate check tool for my EspoCRM backend. I have followed the steps in the docs(https://docs.espocrm.com/development/api-action/):
    • Created custom/Espo/Custom/Controllers/MyController.php with the example specified in the docs:
    Code:
    <?php
    
    namespace Espo\Custom\Controllers;
    
    class MyController extends \Espo\Core\Controllers\Base
    {
        public function getActionDoSomething($params, $data, $request) {
            die("test");
        }
    
        public function postActionHelloWorld($params, $data, $request) {
            $name = $params['name']; // 'someName'
        }
    }
    • Created custom/Espo/Custom/Resources/routes.json with the example specified in the docs:
    Code:
    [
        {
            "route": "/Hello/test/:id",
            "method": "get",
            "params": {
                "controller": "MyController",
                "action": "doSomething",
                "id": ":id"
            }
        },
        {
            "route": "/HelloWorld/:name",
            "method": "post",
            "params": {
                "controller": "MyController",
                "action": "helloWorld",
                "name": ":name"
            }
        }
    ]
    When i visit <crm_url>/#Hello/test/1 i get a 404. Im expecting to see 'test'. Did i overlook something in the docs? I just cant get it to work. Any clues?

    Thanks,
    Thomas

  • #2
    Hi,

    Did you clear cache?

    Comment


    • #3
      Yes, and rebuild it too!

      Comment


      • #4
        You created a backend API action. It is available by URL api/v1/Hello/test/1.

        Frontend has another framework. See https://docs.espocrm.com/development...nd/controller/.

        Comment


        • #5
          hi thodr4, how did you go? Did you manage to get it to work?

          This thread might be of interest to you: https://forum.espocrm.com/forum/gene...icate-checking

          I'm trying to create a duplicate check too but no luck at the moment.

          Comment

          Working...
          X