Dashlet for Compose Email view

Dear SugarClub users. 

I'm using SugarCRM Version 11.0.3 (Build 292 P) (Q2 2021) on Prem.

I have created some simple Dashlets that hold static HTML text. These appear when a Quote is being created or edited. 

I have been able to add a similar dashlet to the Email List and Email Record view, but I would like to add a similar Dashlet to the Compose Email view. i.e. when you select Email | Compose (As in #1 Below)

I would like to add it the Dashlet area of the Email Compose view. (as in #2 below)

For the Email record and list view I have added the relevant Dashlet files to the "./custom/clients/base/views/email-dashlet" directory. i.e.:

  • email-dashlet.hbs
  • email-dashlet.js
  • email-dashlet.php

With the following setting in the email-dashlet.php file. 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
$viewdefs['base']['view']['email-dashlet'] = array(
'dashlets' => array(
array(
'label' => 'Email Dashlet',
'description' => 'Description',
'config' => array(
),
'preview' => array(
),
'filter' => array(
'module' => array(
'Emails'
),
),
),
),
);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

This allows me to add the Dashlet to the Email Record and List view. 

Is there a different way to add this to the Compose view of an email? Thanks for your assistance.

  • Hi Peter I would like to do exactly the same thing as you. Did you find any way to do this?

  • Hi Raquel, 

    Yes I found a way to do this. From my notes you need a few things. You will need to add a few files as below: 

    create-preview.php

    • This is the view to be pulled in for the Email Compose View
    • Create Layouts directory under base
    • Create create-preview directory
    • e.g. \custom\modules\Emails\clients\base\layouts\create-preview\create-preview.php

    compose-email.php

    • The layout that has the array to show the layout create-preview for the Compose Email view.
    • Create compose-email directory
    • e.g. \custom\modules\Emails\clients\base\layouts\compose-email\compose-email.php

    email-text-templates.hbs

    • Contains HTML for Snippets
    • Create views\email-text-templates
    • e.g. \custom\modules\Emails\clients\base\views\email-text-templates\email-text-templates.hbs

    If you have a look at the .hbs file, it contains a few elements and custom CSS. I'm using some collapsible elements (tabs) and other stylings. It will give you the end result as in the image below:

    I'm also using calling some Javascript from Sugar, this will allow you to click on the button and copy the text snippet to your clipboard. I found this at "sugarcrm/include/javascript/sugar7/clipboard.js"

    Remember to check the access permissions and ownership of the new files and folders you create. 

    You will also need a Repair

    Samples of the files are below;

    create-preview.php

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    <?php
    /*
    * Your installation or use of this SugarCRM file is subject to the applicable
    * terms available at
    * http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/.
    * If you do not agree to all of the applicable terms or do not have the
    * authority to bind the entity as an authorized representative, then do not
    * install or use this SugarCRM file.
    *
    * Copyright (C) SugarCRM Inc. All rights reserved.
    */
    $viewdefs['Emails']['base']['layout']['create-preview'] = array(
    'components' => array(
    array(
    'view' => 'email-text-templates',
    ),
    ),
    );
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    compose-email.php

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    <?php
    /*
    * Your installation or use of this SugarCRM file is subject to the applicable
    * terms available at
    * http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/.
    * If you do not agree to all of the applicable terms or do not have the
    * authority to bind the entity as an authorized representative, then do not
    * install or use this SugarCRM file.
    *
    * Copyright (C) SugarCRM Inc. All rights reserved.
    */
    $viewdefs['Emails']['base']['layout']['compose-email'] = array(
    'components' => array(
    array(
    'layout' => array(
    'type' => 'default',
    'name' => 'sidebar',
    'components' => array(
    array(
    'layout' => array(
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    email-text-templates.hbs

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    <style type="text/css">
    .custom-table {
    border-collapse: collapse;
    border-spacing: 0px;
    }
    .custom-table td {
    border-color: black;
    border-style: solid;
    border-width: 1px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    overflow: hidden;
    word-break: normal;
    }
    .custom-table th {
    border-color: black;
    border-style: solid;
    border-width: 1px;
    font-family: Arial, sans-serif;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I hope this information helps. Please let me know if you have any problems. 

  • Hi Peter,

    Thank you so much for taking the time to help me. It's working. Have a nice day. Thanks a lot.