Announcement

Collapse
No announcement yet.

Call Document create Modal with Attachment from Quote Template

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

  • Call Document create Modal with Attachment from Quote Template

    Hi Tanya,

    Good day!

    How may I call or create the Documents modal view for creation?

    I've seen the same functionality I want to happen in Quote Email to PDF functionality.

    Advanced:Views.Quote.Record.Detail
    The snippet below call the Compose Email in the Quote where it automatically attaches the Attachment within the "attributes" object and map it in the compose email modal.

    Code:
    actionComposeEmail: function () {
                this.createView('pdfTemplate', 'views/modals/select-template', {
                    entityType: this.model.name
                }, function (view) {
                    view.render();
                    this.listenToOnce(view, 'select', function (model) {
                        this.notify('Loading...');
                        this.ajaxPostRequest('Quote/action/getAttributesForEmail', {
                            quoteId: this.model.id,
                            templateId: model.id
                        }).done(function (attributes) {
                            var viewName = this.getMetadata().get('clientDefs.Email.modalViews.compose') || 'views/modals/compose-email'; // my line of concern
                            this.createView('composeEmail', viewName, {
                                attributes: attributes,
                                keepAttachmentsOnSelectTemplate: true
                            }, function (view) {
                                view.render();
                                this.notify(false);
                            }, this);
                        }.bind(this));
                    }, this);
                }, this);
            }
    Now, I want to do the same thing but not on compose email modal, but on a Create Documents modal with the PDF attached.

    I already tried the modals for Document entity below but it is not working:

    crm:views/document/modals/select-records
    views/modals/detail
    views/modals/edit

  • #2
    The modal is showing now. It seems there are no "scope" value on the specific modal I want to have as the parent view.

    For transparency, I used below lines:

    Code:
    this.createView('composeEmail', viewName, {
        scope: 'Document', // Entity name
        attributes: attributes,
        keepAttachmentsOnSelectTemplate: true
    }, function (view) {
         view.render();
         this.notify(false);
    }, this);

    Comment


    • #3
      It could also be awesome to be able to "send by email" document from Documents menu.
      Currently, we can just download/open document, but i could be great to have an action "Send by mail" that would open a modal "compose an email" with selected documents directly attached?

      What do you think about it ?

      Comment


      • #4
        Yes it could be done, just refer on the implementation on this file.

        Advanced:Views.Quote.Record.Detail
        I think you just need to add a dropdown list button on the Documents entity detail form and call an action the same as actionComposeEmail.

        My problem is the opposite. I want to make the modal of the Create Document edit form (view/modals/edit) to have auto-attached PDF after selecting a template from Quotes Entity detail form.

        Comment


        • #5
          i don't have advanced pack

          Comment

          Working...
          X