0

I'm trying to create an email template to send to the user when his case is closed. In this email there will be a button and if the user clicks on it the case will be reopen. Is there a way to do this? If not, are there any other ways to make the user able to reopen cases via email? Thnx

<messaging:emailTemplate recipientType="Contact" 
relatedToType="Case"
subject="Olá! Seu caso {!relatedto.CaseNumber} foi resolvido." >
<messaging:htmlEmailBody >
        <html>
            <body>
            <p>{!recipient.name},</p>
            <p>Estamos passando pra dizer que o caso {!relatedto.CaseNumber}, aberto em {!relatedto.CreatedDate}, foi resolvido. Caso
            não concorde com a solução, por favor clique no link abaixo. </p>          
            </body>
            <button> Yes, I accept the solution </button>
            <button> No, I would like to decline the solution </button>
        </html>
        <apex:includeScript/>
    </messaging:htmlEmailBody>
</messaging:emailTemplate>

1 Answers1

0

Do you have a community? If they could log in to community (partner or customer) and view their cases it'd be easy to provide link to the record, they log in and can click button to reopen or something.

If not - you could for example make a Visualforce page, expose it as Site, even to unauthenticated (guest) users. If you'd pass the case id in the URL you could look the record up and reopen. Normally in VF page apex controller you aren't allowed to do DML operations like update so you'd still need a button or cheat with <apex:page action=...> attribute. Using action is against security best practices, see https://salesforce.stackexchange.com/a/28853/799. It'd also be good idea to not have just the case id in the url (hackers?), maybe demand that the url contains also the contact's email, account number or something else you can validate against Case.

You could also try building mailto links in your email. If they'd pointo your email-to-case (standard or with custom email handler) you could use that to reopen? If you go with custom email handler here are some examples and this might help too

eyescream
  • 18,088
  • 2
  • 34
  • 46