Announcement

Collapse
No announcement yet.

Custom button and EntryPoint invocation question (newbie)

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

  • 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.

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

    Comment


    • #3
      Tanya, Thanks, it worked out !

      Comment


      • #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




        Comment


        • #5
          Originally posted by igrp View Post
          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


          • #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


            • #7
              Thank you

              Comment

              Working...
              X