Custom button and EntryPoint invocation question (newbie)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • igrp
    Junior Member
    • May 2017
    • 18

    Custom button and EntryPoint invocation question (newbie)

    Hi!

    I'm trying to implement a custom button with action on it (as entryPoint)

    The code in detail.js:

    Code:
    Espo.define('custom:views/style-expert-certificate/detail', 'views/detail', function (Dep) {
    
        return Dep.extend({
    
            setup: function () {
                Dep.prototype.setup.call(this);
    
                this.menu.buttons.push({
            name: 'printPDFCertificate',
                    label: 'Print PDF Certificate',
                    action: 'printPDFCertificate',
                    acl: 'view'
                });
            },
    
            actionPrintPDFCertificate: function () {
            this.notify('Loading...');
    
            var url_base = this.getBasePath();
            var url_param = '?entryPoint=StyleExpertCertificatePDF&id=' + this.model.id;
            //this.getRouter().navigate( url_base + url_param, {trigger : true} );
            window.location = url_base + url_param;
            }
        });
    });
    The button in in place, but when its clicked i see the following string in adress bar: domain.com/crm/#?entryPoint=StyleExpertCertificatePDF&id=adjksand kjasnkjdas
    but entryPoint code is not called at all.

    In case i manually remove the hash sign from the URL: domain.com/crm/?entryPoint=... The entyPoint code is get called and everything is fine.

    I think there is something wrong with .navigate method or slim framework ? Could you please help.
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello
    For me your example works well, but without url_base
    window.location = url_param;

    Comment

    • igrp
      Junior Member
      • May 2017
      • 18

      #3
      Tanya, Thanks, it worked out !

      Comment

      • item
        Active Community Member
        • Mar 2017
        • 1476

        #4
        Hello,
        I try your code but I dont understand something.

        if will the same, for a record (detail) for entity Contact, were I do put this code ?

        if i will something same for "action button" in target-list. (list view) ? (custom action to all selected record)

        I have read, forum post, tanya link, GitHub help, ... but something I dont understand.

        Regards




        If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

        Comment

        • PGI
          Member
          • Oct 2017
          • 77

          #5
          Originally posted by igrp
          Hi!

          I'm trying to implement a custom button with action on it (as entryPoint)

          The code in detail.js:

          Code:
          Espo.define('custom:views/style-expert-certificate/detail', 'views/detail', function (Dep) {
          
          return Dep.extend({
          
          setup: function () {
          Dep.prototype.setup.call(this);
          
          this.menu.buttons.push({
          name: 'printPDFCertificate',
          label: 'Print PDF Certificate',
          action: 'printPDFCertificate',
          acl: 'view'
          });
          },
          
          actionPrintPDFCertificate: function () {
          this.notify('Loading...');
          
          var url_base = this.getBasePath();
          var url_param = '?entryPoint=StyleExpertCertificatePDF&id=' + this.model.id;
          //this.getRouter().navigate( url_base + url_param, {trigger : true} );
          window.location = url_base + url_param;
          }
          });
          });
          The button in in place, but when its clicked i see the following string in adress bar: domain.com/crm/#?entryPoint=StyleExpertCertificatePDF&id=adjksand kjasnkjdas
          but entryPoint code is not called at all.

          In case i manually remove the hash sign from the URL: domain.com/crm/?entryPoint=... The entyPoint code is get called and everything is fine.

          I think there is something wrong with .navigate method or slim framework ? Could you please help.
          Hello,
          Can you tell me where the file "details.js" is located?
          I can't add a button.
          Thank you

          Comment

          • tanya
            Senior Member
            • Jun 2014
            • 4308

            #6
            Hello

            https://www.espocrm.com/documentatio.../custom-views/

            if view name starts with 'views/', the source is located client/src/views/
            if view name starts with '{module}:views/' - client/modules/{module}/src/views
            if view name starts with 'custom:views/' - it is located client/custom/src/views/

            Espo.define('custom:views/style-expert-certificate/detail', 'views/detail', function (Dep) {

            'views/detail' is located client/src/views/detail.js
            'custom:views/style-expert-certificate/detail' - has to be located client/custom/src/views/style-expert-certificate/detail.js
            Last edited by tanya; 01-29-2018, 01:30 PM.

            Comment

            • PGI
              Member
              • Oct 2017
              • 77

              #7
              Thank you

              Comment

              Working...