Record Creation From Inbound Emails Missing #5169

Open
opened 2026-02-20 16:30:51 -05:00 by deekerman · 3 comments
Owner

Originally created by @pstevens71 on GitHub (Feb 20, 2024).

Issue

The issue is that if an email is already imported there are a whole bunch of other options in the ACTIONS menu like: Create Case, Create Bug, Create Lead... etc.
image

However, when an email is not imported yet, these options are missing (and would be super convenient!!!)

I found the problem. These two views use different viewdefs depending if the email has been imported or not. These button options are just missing from the non-imported email view.

Expected Behavior

I'd expect to see the same options on non-imported email as I do when I'm viewing an already imported email.

Actual Behavior

What actually happens is for non-imported emails this template is used instead: \modules\Emails\metadata\nonimporteddetailviewdefs.php which doesn't contain all the button options. It's almost like they are forgotten.

Possible Fix

The fix is easy, just copy in the button code to the nonimporteddetailviewdefs.php as well as the includes for the quickcreate:

                    'customCode' => '<input type=button onclick="openQuickCreateModal(\'Bugs\',\'&name={$bean->name}\',\'{$bean->from_addr_name}\');" value="{$MOD.LBL_CREATE} {$APP.LBL_EMAIL_QC_BUGS}">'
                        . '<input type="hidden" id="parentEmailId" name="parentEmailId" value="{$bean->id}">'
                ),
				array(
                    'customCode' => '<input type=button onclick="openQuickCreateModal(\'Cases\',\'&name={$bean->name}\',\'{$bean->from_addr_name}\');" value="{$MOD.LBL_CREATE} {$APP.LBL_EMAIL_QC_CASES}">'
                        . '<input type="hidden" id="parentEmailId" name="parentEmailId" value="{$bean->id}">'
                ),
                array(
                    'customCode' => '<input type=button onclick="openQuickCreateModal(\'Contacts\',\'&last_name={$bean->name}\',\'{$bean->from_addr_name}\');" value="{$MOD.LBL_CREATE} {$APP.LBL_EMAIL_QC_CONTACTS}">'
                        . '<input type="hidden" id="parentEmailId" name="parentEmailId" value="{$bean->id}">'
                ),
                array(
                    'customCode' => '<input type=button onclick="openQuickCreateModal(\'Leads\',\'&last_name={$bean->name}\',\'{$bean->from_addr_name}\');" value="{$MOD.LBL_CREATE} {$APP.LBL_EMAIL_QC_LEADS}">'
                        . '<input type="hidden" id="parentEmailId" name="parentEmailId" value="{$bean->id}">'
                ),
                array(
                    'customCode' => '<input type=button onclick="openQuickCreateModal(\'Opportunities\',\'&name={$bean->name}\',\'{$bean->from_addr_name}\');" value="{$MOD.LBL_CREATE} {$APP.LBL_EMAIL_QC_OPPORTUNITIES}">'
                        . '<input type="hidden" id="parentEmailId" name="parentEmailId" value="{$bean->id}">'
                ), ```


And to the includes array:


```array(
                'file' => 'modules/Emails/include/DetailView/quickCreateModal.js',
            ),``` 



#### Steps to Reproduce
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug include code to reproduce, if relevant -->
1. Look at an email that has not been imported, all the record creation options are missing
2.Look an an email that has been imported, you will see all the creation options
3. Add the button code and the includes to \modules\Emails\metadata\nonimporteddetailviewdefs.php
4. enjoy the new functionality!
5. 
#### Context
<!--- How has this bug affected you? What were you trying to accomplish? -->
<!--- If you feel this should be a low/medium/high priority then please state so -->
This is super useful because often you get emails in a personal email (non group account) that is not already imported and you'd like to do things like create cases, opportunities, etc. 

#### Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* SuiteCRM Version used: 7.12.8
* Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)):
* Environment name and version (e.g. MySQL, PHP 7):  PHP 7.4
* Operating System and version (e.g Ubuntu 16.04):

Originally created by @pstevens71 on GitHub (Feb 20, 2024). <!--- Provide a general summary of the issue in the **Title** above --> <!--- Before you open an issue, please check if a similar issue already exists or has been closed before. ---> <!--- If you have discovered a security risk please report it by emailing security@suitecrm.com. This will be delivered to the product team who handle security issues. Please don't disclose security bugs publicly until they have been handled by the security team. ---> <!--- Please be aware that as of the 31st January 2022 we no longer support 7.10.x. New issues referring to 7.10.x will only be valid if applicable to 7.12.x and above. If your issue is still applicable in 7.12.x, please create the issue following the template below --> #### Issue <!--- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug --> <!--- Ensure that all code ``` is surrounded ``` by triple back quotes. This can also be done over multiple lines --> The issue is that if an email is already imported there are a whole bunch of other options in the ACTIONS menu like: Create Case, Create Bug, Create Lead... etc. ![image](https://github.com/salesagility/SuiteCRM/assets/29544935/00bdadd5-34b3-40f2-95d7-94946e24d27f) However, when an email is not imported yet, these options are missing (and would be super convenient!!!) I found the problem. These two views use different viewdefs depending if the email has been imported or not. These button options are just missing from the non-imported email view. #### Expected Behavior <!--- Tell us what should happen --> I'd expect to see the same options on non-imported email as I do when I'm viewing an already imported email. #### Actual Behavior <!--- Tell us what happens instead --> <!--- Also please check relevant logs (suitecrm.log, php error.log etc.) --> What actually happens is for non-imported emails this template is used instead: \modules\Emails\metadata\nonimporteddetailviewdefs.php which doesn't contain all the button options. It's almost like they are forgotten. #### Possible Fix <!--- Not obligatory, but suggest a fix or reason for the bug --> The fix is easy, just copy in the button code to the nonimporteddetailviewdefs.php as well as the includes for the quickcreate: ``` array( 'customCode' => '<input type=button onclick="openQuickCreateModal(\'Bugs\',\'&name={$bean->name}\',\'{$bean->from_addr_name}\');" value="{$MOD.LBL_CREATE} {$APP.LBL_EMAIL_QC_BUGS}">' . '<input type="hidden" id="parentEmailId" name="parentEmailId" value="{$bean->id}">' ), array( 'customCode' => '<input type=button onclick="openQuickCreateModal(\'Cases\',\'&name={$bean->name}\',\'{$bean->from_addr_name}\');" value="{$MOD.LBL_CREATE} {$APP.LBL_EMAIL_QC_CASES}">' . '<input type="hidden" id="parentEmailId" name="parentEmailId" value="{$bean->id}">' ), array( 'customCode' => '<input type=button onclick="openQuickCreateModal(\'Contacts\',\'&last_name={$bean->name}\',\'{$bean->from_addr_name}\');" value="{$MOD.LBL_CREATE} {$APP.LBL_EMAIL_QC_CONTACTS}">' . '<input type="hidden" id="parentEmailId" name="parentEmailId" value="{$bean->id}">' ), array( 'customCode' => '<input type=button onclick="openQuickCreateModal(\'Leads\',\'&last_name={$bean->name}\',\'{$bean->from_addr_name}\');" value="{$MOD.LBL_CREATE} {$APP.LBL_EMAIL_QC_LEADS}">' . '<input type="hidden" id="parentEmailId" name="parentEmailId" value="{$bean->id}">' ), array( 'customCode' => '<input type=button onclick="openQuickCreateModal(\'Opportunities\',\'&name={$bean->name}\',\'{$bean->from_addr_name}\');" value="{$MOD.LBL_CREATE} {$APP.LBL_EMAIL_QC_OPPORTUNITIES}">' . '<input type="hidden" id="parentEmailId" name="parentEmailId" value="{$bean->id}">' ), ``` And to the includes array: ```array( 'file' => 'modules/Emails/include/DetailView/quickCreateModal.js', ),``` #### Steps to Reproduce <!--- Provide a link to a live example, or an unambiguous set of steps to --> <!--- reproduce this bug include code to reproduce, if relevant --> 1. Look at an email that has not been imported, all the record creation options are missing 2.Look an an email that has been imported, you will see all the creation options 3. Add the button code and the includes to \modules\Emails\metadata\nonimporteddetailviewdefs.php 4. enjoy the new functionality! 5. #### Context <!--- How has this bug affected you? What were you trying to accomplish? --> <!--- If you feel this should be a low/medium/high priority then please state so --> This is super useful because often you get emails in a personal email (non group account) that is not already imported and you'd like to do things like create cases, opportunities, etc. #### Your Environment <!--- Include as many relevant details about the environment you experienced the bug in --> * SuiteCRM Version used: 7.12.8 * Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): * Environment name and version (e.g. MySQL, PHP 7): PHP 7.4 * Operating System and version (e.g Ubuntu 16.04):
Author
Owner

@chris001 commented on GitHub (Feb 20, 2024):

Nice discovery! When you Create Bug, Case, Contact, Lead, Opportunity, from a not-imported email, isn't that bad, because the email's sitting out at the mail server, it's not imported, so that means you don't have its contents/headers saved in the db to refer back to later on when needed. You want the email to be imported to the db when it's relevant enough to create these actionable CRM objects: a bug, case, contact, lead, or opportunity, right?

@chris001 commented on GitHub (Feb 20, 2024): Nice discovery! When you `Create Bug`, `Case`, `Contact`, `Lead`, `Opportunity`, from a not-imported email, isn't that bad, because the email's sitting out at the mail server, it's not imported, so that means you don't have its contents/headers saved in the `db` to refer back to later on when needed. You want the email to be imported to the `db` when it's relevant enough to create these actionable CRM objects: a bug, case, contact, lead, or opportunity, right?
Author
Owner

@SuiteBot commented on GitHub (Feb 21, 2024):

This issue has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/suitecrm-email-client-how-to-create-any-record-lead-contact-etc-manually-directly-in-7-10-2/56212/11

@SuiteBot commented on GitHub (Feb 21, 2024): This issue has been mentioned on **SuiteCRM**. There might be relevant details there: https://community.suitecrm.com/t/suitecrm-email-client-how-to-create-any-record-lead-contact-etc-manually-directly-in-7-10-2/56212/11
Author
Owner

@pstevens71 commented on GitHub (Feb 21, 2024):

Hey Chris, there are many use cases where you want to create the record first and then import it. For example, you get a referral ie; "company abc referred me to you, lets talk about xyz" What you really want to do is attach the email to a lead, but there is no lead yet. So you have to go and create a lead in the lead module, come back to email and then attach it. With this modification, you can now create the lead right from the inbox. Once the lead is created, it gives you the option to return to the email, which you can then import and attach to the lead. Not perfect, but way better. Ideally, the email would be imported and related to the record just created. I'm going to further investigate how hard it would be to hook into the import function at the same time and maybe do it all in one step.

@pstevens71 commented on GitHub (Feb 21, 2024): Hey Chris, there are many use cases where you want to create the record first and then import it. For example, you get a referral ie; "company abc referred me to you, lets talk about xyz" What you really want to do is attach the email to a lead, but there is no lead yet. So you have to go and create a lead in the lead module, come back to email and then attach it. With this modification, you can now create the lead right from the inbox. Once the lead is created, it gives you the option to return to the email, which you can then import and attach to the lead. Not perfect, but way better. Ideally, the email would be imported and related to the record just created. I'm going to further investigate how hard it would be to hook into the import function at the same time and maybe do it all in one step.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SuiteCRM-SuiteCRM#5169
No description provided.