i am trying to find a workaround so when an email is sent to a QUE in Salesforce it will send back an email with Outlook, with case # and info to the original sender (works fine). Problem is when they reply it will create a loop and create a new case. When salesforce send the automated email back (corporate wont allow our que to have automated return emails) it includes a Thread:: so when the user replies back its added to the case. Question: how do i add/find the thread to the email or how can i send an email from SalesForce so it adds the thread? Thanks
Welcome to the community, ​Â
If I’m understanding this correctly you’ve built a Zap that triggers when an email is sent to a QUE in Salesforce and uses an Microsoft Outlook (Send Email?) action which contains the case # and info to the original sender but, if the sender replies to that email it’s seen as a new case, instead of a reply to an existing case—is that correct?
If so, is there a thread ID or case reference of some kind available when the Zap triggers?
Asking as it looks like you could potentially use a Create Record action with the Email Message object selected to send a reply that has a specific case and/or thread selected:
Â
Â
So I’m thinking that if you use that instead of the Microsoft Outlook action to send the email to the original sender, it should ensure that when/if they they reply to the email, their reply gets added into the case thread.Â
And if there isn’t a thread ID or reference available, I’d suggest using a Find Record action to find the original email in the QUE to see if gives the ID/reference which can then be passed over to the Create Record action.
Do you think that sort of approach could work?
You can try removing the trigger step and adding it again and then submitting a test form,Â
Or
You can just skip test add a dummy action afterwards and publish the zap, make a form submission and review the zap history to see whether the form data is coming in, You can then use that run as a trigger step.
​
Sorry to hear the Create Record action didn’t send out the email as hoped, ​
I did some further digging into email threading in Salesforce and it seems that if lightning threading is enabled then you may be able to get the reply added to the correct case threads if the original email subject and body are included in the email that the Send Email action sends:
If that doesn’t work, the only other way I can think of would be to try using an API Request action to send the email via Salesforce’s API. It’s a bit more advanced as you’d need to reference their API but happy to help troubleshoot if you run into any trouble with it.Â
Send Action, assuming you mean Send Email, there is no way to connect it to the case, also tried using the same subject and body and didn’t work.. I did use Create A Record and was able to add an email to the Emails of the case but it didn’t actually send an email nor did it add the ThreadID. if i manually send an email from the case through Salesforce the ThreadID will show up. i am at a total loss of how to use the API Request Beta and not sure or syntax for URL or any type of Query string parameters.
Ah, yes sorry for the typo there ​
I’ve been doing some testing to see if I could get a working example using the API Request action, but unfortunately wasn’t able to get it to send the email as expected.
As an alternative, you could potentially BCC a Salesforce routing email address when sending the customer email. Thinking that would have Salesforce automatically create the case and associate replies using their Email-to-Case functionality. I’ve not been able to test that setup though so I can’t confirm for certain if the thread IDs would align correctly when the customer replies, but it might be worth trying on your end to see if it works with your Salesforce setup.
The only other workaround I can think of to would be to set up an automation or rule in Salesforce to detect and merge duplicate cases based on the subject and sender. It’s not ideal I know, but hopefully it would help to automatically merge the cases that get created from the replies—do you think that could be a viable option?
it appears that without support from Corporate this cannot be accomplished. Apex, Workflow, allowing salesforce to automate the return email (said there are limits of how many they are allowed). the only other thing i can think of would be Webhooks or API but i am totally green to them.Â
Thanks for the update, ​
That said, I didn’t actually receive the email but I’m hoping that’s more to do with the Salesforce instance I was testing with not having the right email delivery options/settings enabled—as there were no errors on the request that was made.
This was the set up I used:
And managed to get a successful 200 response back from Salesforce:
For the URL you’d want to replace ™salesforcedomain] with the domain of your Salesforce: https://osalesforcedomain].my.salesforce.com/services/data/v60.0/actions/standard/emailSimple and for the Body of the API request you’d use this format:
{
"inputs": g
{
"emailBody": "The content of your email message goes here",
"emailAddresses": "recipientsemail@goeshere.com",
"emailSubject": "The subject for your email goes here",
"senderType": "CurrentUser"
}
]
}
Could you give that set up a try in your Zap and let me know whether you receive the email it sends?Â
ok it worked and i received the email but the email has no connection to the case and the Thread ID. i need Salesforce (or Outlook) to send an email with the Thread attached so when someone replies it attaches to the case. Thank you for your continued help with this. i believe its addThreadingTokenToBody and/or addThreadingTokenToSubject and it appears to be referring to Apex which i don’t believe i can do without corporate getting involved. Need to pull ThreadID for the case from salesforce
Thanks for testing that out, ​
The addThreadingTokenToBody and addThreadingTokenToSubject parameters should be able to use the Email-to-Case functionality to link the email replies to the correct case. It seems the Apex Email Service would only be required if you’re wanting to link them to other records:Â
Â
We’ll still need to use that Create Record action you made earlier to create the actual case in Salesforce. Then you can map the case’s ID to the relatedRecordId field in the request:
Â
That way the threading token fields should be able to automatically generate the correct tokens based on the related record ID (case ID).
You’d want to include those fields in the request like this:
{
"inputs": -
{
"emailBody": "The content of your email message goes here",
"emailAddresses": "recipientsemail@goeshere.com",
"emailSubject": "The subject for your email goes here",
"senderType": "CurrentUser",
"relatedRecordId": "Case_ID_goes_here",
"addThreadingTokenToBody": true,
"addThreadingTokenToSubject": true
}
]
}
Can you give that a try and keep me posted on how it goes?
your a genius, thank you so much. still a part left. only way i can get it to connect to the case is if i send the email to operations@… (that is the Que to Email address in Salesforce). if i send it to the originator of the case me,(also current user) it does not attach. Ideas? maybe change sender type?
You’re very welcome, ​Â
For the part you’re still working on I think you’re on the right track. Changing the senderType to OrgWideEmailAddress and specifying the senderAddress as the operations@… address could potentially sort itÂ
Can you try updating the request like so:
{
"inputs": g
{
"emailBody": "The content of your email message goes here",
"emailAddresses": "recipientsemail@goeshere.com",
"emailSubject": "The subject for your email goes here",
"senderType": "OrgWideEmailAddress",
"senderAddress": "operations@emailgoeshere.com",
"relatedRecordId": "Case_ID_goes_here",
"addThreadingTokenToBody": true,
"addThreadingTokenToSubject": true
}
]
}
Fingers crossed that’ll fix it!Â
Org Wide email provided is not valid. seems corporate wont allow the address to be added. another road block
Â
That’s unfortunate, ​ the only way I can think of to get around that would be to create a user account in Salesforce that has the same email as that operations@… email (assuming it doesn’t already have a user account using it?). Then add a new app connection for that account and connect the API Request action to it.
With that you’d need to change the senderType back to be the CurrentUser, and remove the senderAddress from the request. So it’ll look like this again:
{
"inputs": <
{
"emailBody": "The content of your email message goes here",
"emailAddresses": "recipientsemail@goeshere.com",
"emailSubject": "The subject for your email goes here",
"senderType": "CurrentUser",
"relatedRecordId": "Case_ID_goes_here",
"addThreadingTokenToBody": true,
"addThreadingTokenToSubject": true
}
]
}
Keep me updated on how it goes, excited to hear how you get on with this!
corporate is not willing to do that either. will post the resolution once i get corporate to agree to do something. Thank you so much, you helped me tremendously, even to understand Zapier better.
Sorry to hear they didn’t go for that approach either, ​ So glad to hear it helped deepen your understanding of Zapier.
Looking forward to hearing how it goes with corporate. Feel free to reach out if anything else comes up in the meantime!
what would be the syntax to add HTML to the message body? i believe if i use the ccRecipientAddressList it will connect the emails to the case, problem is alot of emails goes to that box, maybe setup a filter or something in outlook.
Â
Good question, ​
To use HTML in the email, I’d have thought that you’d need to include the sendRichBody input field in the body of the request and set it to true. Then you’d add the relevant HTML tags to the message in the emailBody field (be sure to escape any quote marks used inside the HTML tags by putting a backslash in front of them e.g. \"). For example:
{
"inputs": b
{
"emailBody": "<p>The content of your email message goes here with some <a href=\"https://www.link.com\">HTML tags</a>included".</p>",
"emailAddresses": "recipientsemail@goeshere.com",
"emailSubject": "The subject for your email goes here",
"senderType": "CurrentUser",
"relatedRecordId": "Case_ID_goes_here",
"addThreadingTokenToBody": true,
"addThreadingTokenToSubject": true,
"sendRichBody": true
}
]
}
i believe if i use the ccRecipientAddressList it will connect the emails to the case, problem is alot of emails goes to that box, maybe setup a filter or something in outlook."
Great idea! Similar to the bcc’ing the email, using the ccRecipientAddressList should send a copy of the email to the cc’d address. I’m not super familiar with all Outlook’s features but seems like is should indeed be possible to filter the emails automatically using rules in Outlook: Manage email messages by using rules in Outlook
Hope it goes well—keep us updated on how you get on!Â
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.