Archive Email Button in History Subpanel?

Does anyone know the purpose of this button or what it’s intended to do?

This one goes in the category of learn something new every day.

In the history subpanel there is a button for “Archive Email” When pressed an archive email create comes up, but there is no place to put an email? Not sure what the purpose of this is and/if it’s broken.

Thought I’d give this one a bump. No one every responded. I’d love to know what the intended purpose of this button is?

I don’t know, but if you check the browser dev tools, network tab, you can see the request generated when you press the mysterious button.

Tell me what it is and I can try helping you find the code it runs

Here’s what I find with my Sherlock Holmes hat on :slight_smile:

\include\generic\SugarWidgets\SugarWidgetSubPanelTopArchiveEmailButton.php

#[\AllowDynamicProperties]
class SugarWidgetSubPanelTopArchiveEmailButton extends SugarWidgetSubPanelTopButton
{
    public function display($defines, $additionalFormFields = null, $nonbutton = false)
    {
        if ((ACLController::moduleSupportsACL($defines['module'])  && !ACLController::checkAccess($defines['module'], 'edit', true) ||
            $defines['module'] == "History" & !ACLController::checkAccess("Emails", 'edit', true))) {
            $temp = '';
            return $temp;
        }
        
        global $app_strings;
        global $mod_strings;
        global $currentModule;

        $title = $app_strings['LBL_TRACK_EMAIL_BUTTON_TITLE'];
        $value = $app_strings['LBL_TRACK_EMAIL_BUTTON_LABEL'];
        $this->module = 'Emails';

        $additionalFormFields = array();
        $additionalFormFields['type'] = 'archived';
        // cn: bug 5727 - must override the parents' parent for contacts (which could be an Account)
        $additionalFormFields['parent_type'] = $defines['focus']->module_dir;
        $additionalFormFields['parent_id'] = $defines['focus']->id;
        $additionalFormFields['parent_name'] = $defines['focus']->name;

        if (isset($defines['focus']->email1)) {
            $additionalFormFields['to_email_addrs'] = $defines['focus']->email1;
        }
        if (ACLController::moduleSupportsACL($defines['module'])  && !ACLController::checkAccess($defines['module'], 'edit', true)) {
            $button = "<input id='".preg_replace('[ ]', '', (string) $value)."_button'  title='$title' class='button' type='button' name='".preg_replace('[ ]', '', mb_strtolower($value, 'UTF-8'))."_button' value='$value' disabled/>\n";
            return $button;
        }
        $button = $this->_get_form($defines, $additionalFormFields);
        $button .= "<input id='".preg_replace('[ ]', '', (string) $value)."_button' title='$title' class='button' type='submit' name='".preg_replace('[ ]', '', mb_strtolower($value, 'UTF-8'))."_button' value='$value'/>\n";
        $button .= "</form>";
        return $button;
    }
}

That’s relevant, it’s the part generating the button on screen, but I’d still like to know the network call it generates, to see where the code is going after clicked.

Thanks @pgr, is this what you’re asking for?

/index.php?module=Alerts&action=get&to_pdf=1

That’s what’s in the Network tab when I click on the link.

That’s the sort of thing I’m asking for, but that specific one is not the one we want. That one appears regularly, it’s a recurrent request to check for any new notifications (alerts) to appear on the top menu.

There should be one specific to the module where you’re at, that appears when you click, and only when you click (not just because some timer elapsed).

With this we can chase the task down the controller(s) and find out what is being called…

Here’s what gets called, I’m thinking if this added the TinyMCE and the “body” field, then you’d be able to manually cut and paste in an email to archive. I’m thinking this might be what it is for, but he “body” appears to be missing?

/vendor/tinymce/tinymce/tinymce.min.js?v=ujnWJ5DINpgZqMvc8r6doQ
/cache/include/javascript/sugar_field_grp.js?v=ujnWJ5DINpgZqMvc8r6doQ

Everything else appears to be just language or css files.

I checked in studio for create and quick create, but there doesn’t seem to be a way to add the “body” of the email.

It does in fact save an email record in history, but without body content. (or any other important fields like from and to, etc.)

That’s interesting, but I guess what I am looking for is not related to TinyMCE, and re-reading everything I apologize but I have been asking the wrong question.

The real question I should be asking is what is the network request when you press the Save button on the pop-up. That’s when the interesting back-end code will run…

Sorry.

Any way, I guess that from what you’ve observed from the results, you already know what this is - the archival of the “fact” that there was an email, but not of the contents or any other details. I doubt this is useful for anyone, but maybe… maybe the link to the original (complete) email record persists somewhere in the database, but then we don’t have an easy way to get there…

There’s nothing really notable when I save the record. I just goes to detail view after save and all the generated stuff in Network seems to be for the detail view.

In which module are you doing this? Which buttons do you click etc. I’d like to try and reproduce the issue. There must be a network request for the save…

In 8 it looks even a bit more odd.
(I use the subpanel inside an Opp)

When I create this email, I can see the record in the history subpanel.
(which I can’t click, since it’s missing the subject)

Is it possible, that it was intented to ‘create’ an email manually (that was received already, whilst IMAP hasn’t been configured, yet)?
Since my email status is archived - even though I have not selected it from the drop down.

Or something like a feature for the Outlook plugin which ‘accidently’ has this UI feature, which was meant to be for testing or similar?

@pgr it’s history subpanel in any module. In my case I’m testing in the leads module.

image

Ok so the requests are like this (POST parameters shown as JSON):

Clicking “Archive email” button:

{
	"module": "Emails",
	"account_id": "1b4d2fc9-24e0-92c9-1eed-668e5ba54019",
	"account_name": "Jungle+Systems+Inc",
	"History_name": "Jungle+Systems+Inc",
	"return_module": "Accounts",
	"return_action": "DetailView",
	"return_id": "1b4d2fc9-24e0-92c9-1eed-668e5ba54019",
	"return_relationship": "History",
	"return_name": "Jungle+Systems+Inc",
	"action": "EditView",
	"type": "archived",
	"parent_type": "Accounts",
	"parent_id": "1b4d2fc9-24e0-92c9-1eed-668e5ba54019",
	"parent_name": "Jungle+Systems+Inc",
	"to_email_addrs": "dev.kid.im@example.com",
	"archiveemail_button": "Archive+Email"
}

Clicking “Save” button:

{
	"module": "Emails",
	"record": "",
	"isDuplicate": "false",
	"action": "Save",
	"return_module": "Accounts",
	"return_action": "DetailView",
	"return_id": "1b4d2fc9-24e0-92c9-1eed-668e5ba54019",
	"module_tab": "",
	"contact_role": "",
	"relate_to": "History",
	"relate_id": "1b4d2fc9-24e0-92c9-1eed-668e5ba54019",
	"offset": "1",
	"assigned_user_name": "will",
	"assigned_user_id": "seed_will_id",
	"parent_type": "Accounts",
	"parent_name": "Jungle+Systems+Inc",
	"parent_id": "1b4d2fc9-24e0-92c9-1eed-668e5ba54019",
	"category_id": "Archived"
}

I’ll have to try and figure out what that does… doesn’t look too easy since it goes through the generic save action which is probably used for many other things.

I wonder what Archive email could mean when you don’t even get a chance to select a specific email to archive…

@pgr I know it’s a mystery. When you select inbox folders to view there is an option to view “archive” folder, but it doesn’t work. And there doesn’t seem to be any way in the email module to add emails to the archive??

image

I tried this too, and there is no way to “mass update” or even inline edit to change the category.

image

And no way to edit the category in detail view for emails.

Maybe this sheds some light

https://support.sugarcrm.com/documentation/sugar_versions/12.0/ent/application_guide/emails/#Manually_Creating_Archived_Emails

but if this is what it is supposed to be in SuiteCRM also, the functionality seems broken, there’s is no email editor shown for you to manually put in email details and text.

1 Like