function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Katie DeLuna 18Katie DeLuna 18 

How to create a custom button on Case to send an email from Outlook

I want our end uses to be able to send emails via outlook from salesforce by using a custom button. I'm sure it will need to be javascript or something of the sort, but I am not a developer. Does anyone have sample code to be able to do this so that I can have some basic info populate like case subject, the case contact auto populate, ref ID, etc? I want outlook to open when they click the case, and I want the cases to tie back to Salesforce when it's sent, and the email replies also come back to outlook (as well as salesforce). 
Gobinath AGobinath A
Hi Katie,

Setup the email to case and you will get the unique emial for creating the case. After that, you have to do the below setup and udpate that unique emial id in the below code snippet. 

Here’s how I did it. It’s pretty straight-forward, but took me longer than it should of. Hope this helps you out.

Enable Developer Tab

1. Open Outlook -> File -> Options -> Customize Ribbon -> Check the Developer Tab

User-added image


Create Macro

1. Click on Developer Tab -> Click on Visual Basic Button

User-added image

2. Double Click “Project1->Microsoft Outlook Objects->ThisOutlookSession”. Copy and Paste the following code into the code window.
 
Public Sub CcAndSend()
Dim mail As Outlook.MailItem
Set mail = Application.ActiveInspector.CurrentItem
mail.cc = mail.cc & ";<enter your email here>"
mail.Send
End Sub
Replace with the email that you want to Cc.
 
User-added image


Add Button to Ribbon


1. Open a New Email Message -> Right Click on Ribbon -> Select Customize Ribbon

User-added image

2. On the right, Click ‘New Mail Message’

User-added image

3. Click ‘New Group’

Please refer the below to know about the next steps. 

http://merfantz.com/blog/how-to-create-a-custom-button-to-send-an-email-from-outlook/

Please contact us, if you need anyother support, 
http://www.merfantz.com/contact
​​​​​​​
Thanks.