How to add "Insert Email" from custom module records in To, CC, BCC

Hey Guys,
I am having a hard time figuring this out!

When you are composing an email, and focus on the to, cc, and bcc fields, it will give the option to insert an email from Accounts, Leads, Targets, Contacts, and users modules.

My question is, how can I add a button to insert email from a custom module I created?

the custom module is “prchs_Vendors” and display label is “Vendors”.

I copied /modules/Emails/include/ComposeView/EmailsComposeView.js to custom/modules/Emails/include/ComposeView/EmailsComposeView.js

      '<button class="btn btn-default btn-sm btn-qtip-bar" data-open-popup-module="prchs_Vendors" title="' + SUGAR.language.translate('Emails', 'LBL_INSERT_VENDORS_EMAIL') + '"><span class="glyphicon"><img src="themes/' + SUGAR.themes.theme_name + '/images/sidebar/modules/Users.svg"></span></button>' +

under the

self.qtipBar =

section of the code.

However, it is not showing anything. It shows the default 5 buttons.

Does anybody know what I have to do to achieve this?

Anybody has found a solution to this?

Did you also include your new custom JS file into the composeviewdefs.php file and replace the original?

Thanks for your reply!
no. do you know how to achieve this?
I tried looking for the current JS code that is being used to pull the email from default modules but no success yet.

If you don’t already have a custom version of this metadata file, you should create it now. If you look at this file you should find the following line in the includes array:
'file' => 'modules/Emails/include/ComposeView/EmailsComposeView.js',
Just update the file path to point to your custom JS file and run a Quick Repair and Rebuild, and give it another try.