How to intercept Kanban stage chnge wth confrmation prompt before moving to "Closed"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cristobalcgz
    Junior Member
    • May 2025
    • 1

    #1

    How to intercept Kanban stage chnge wth confrmation prompt before moving to "Closed"

    Hi everyone,

    I'm customizing EspoCRM for a telco sales CRM. I've renamed the Opportunity entity to Funnel and I'm using the Kanban view for managing stages.

    I'm trying to show a confirmation message when a user drags a funnel card to the "Cierre" (Closed) stage. The idea is to alert the user that once the funnel is closed, it will disappear from their view and become inaccessible to them (it goes to a back-office team).

    So far, I’ve tried adding logic to a custom Controllers/Opportunity.php with a postOrder() method, but EspoCRM seems to completely ignore the contents of the custom/ folder.

    I've also tried editing frontend files, like creating a custom kanban.js under client/custom/src/views/opportunity/, but that doesn’t seem to be picked up either.

    My questions are:
    1. What is the correct way to intercept the drag-and-drop stage change in the Kanban view?
    2. Where can I add a JavaScript confirmation prompt that will run before the stage change is accepted?
    3. Is there a way to override the default Kanban behavior cleanly and reliably?

    Any help or guidance would be much appreciated! 🙏

    Thanks in advance,
    Cristóbal
  • yuri
    Member
    • Mar 2014
    • 9019

    #2
    Hi Cristobal,

    You'll need to customize the kanban view https://github.com/espocrm/espocrm/b...cord/kanban.js

    You can either define a custom (extended) view or use a view setup helper. metadata: clientDefs/Opportunity.
    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

    • cristobalcgz
      Junior Member
      • May 2025
      • 1

      #3
      Hi, thanks for your reply!

      I'm currently using EspoCRM version 9.1.4, and I don't have the file or path you mentioned:

      client/src/views/record/kanban.js

      Instead, it seems like the contents from that GitHub file are actually bundled inside client/lib/original/espo-main.js in my installation.

      So far, I've been modifying behavior by working directly with what's inside espo-main.js, but I understand that's not the ideal or cleanest approach. Let me know if there's a better way to override or extend the Kanban behavior properly in this version.

      Thanks again!

      Cristóbal

      Comment

      • yuri
        Member
        • Mar 2014
        • 9019

        #4
        You can extended it in the custom without bundling.

        custom/Espo/Custom/Resources/metadata/clientDefs/Opportunity.json

        Code:
        {
            "recordViews": {
                "kanban": "custom:views/record/my-kanban"
            }
        }

        client/custom/src/views/record/my-kanban.js

        Code:
        define(['views/record/kanban'], (KanbanRecordView) => {
            
            return class extends KanbanRecordView {
        
            };
        });
        Clear cache.

        Note that internals of the view are not guaranteed not to be changed in future versions.
        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...