We have a case where our users create tasks. When they create tasks, they also check the “Send Email Notification” checkbox present on the task. As a result the owner of the task, receives an email containing task details and a link to the task. However, when the user clicks on the link received in the email, he is redirected to the homepage instead of the task record detail page. I did notice one difference in the link present in the email and the actual URL that is required to navigate to the task record.
The atual URL needed to navigate to the records is as below:
Wheras the URL recieved in the mail is:
I dont understand why this difference in the URL. We are using SSO in our org. Is it the reason? We are also using Cipher Cloud to encrypt/decrypt our data. Can this be one of the reason?
I also tried this for other objects by using Workflow Email Alerts (Using Object.Link merge field). But the difference in the URL still persists.
What can be done so that the proper URL is sent in the mail?
- Though this option is not feasible, since it would require us to do the same on all the objects, I thought I will create a formula field and get the server URL dynamically and append it with the record Id. BUT even the formula field returns the URL that we receve in the email and not the one which is seen in the browser address bar.
- I thought of creating a custom setting that will store the hardcoded URL and use it in E-mail template. But it appears we cant refer the custom setting in the Email Template.
- FOR OTHER OBJECTS: I created a formula field for few(not all) objects. The formula refers the custom setting I created as mentioned in point 2 . And I am referring this formula in the mail alert. This works for those objects.
- FOR TASKS: As workflow email alerts are not allowed. I had to write a trigger for tasks(in this case I am simply referring the custom setting). This also works.
SO now at this point I have a working solution but one which is not a good solution I think. The reason I say its not a good solution is because I would need to do the same thing for all objects involving email alerts.
Hence, I want to know if there is something generic by which I can pass the proper link.
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
As a couple commenters have pointed out, this is a bug. The only people who can help you is Salesforce support.
Given the compliance issues you’ve mentioned you have a couple options. First, is to do it in brand new dev org, and then get it setup so you can reproduce the issue there. Second, create a developer sandbox which will only have your config and none of your data (with some exceptions, like the user table) and then ask your compliance team to grant an exception given your lack of options and the fact no data will be accessible to Salesforce support.
Best of luck with this. You’re going to have a lot of challenges down the road with that policy.
My suggestion would be to contact Salesforce support and raise a case with them. This is built in functionality of the platform. They should be able to resolve it for you.
Yeah it sounds like this is a bug, as I’m not able to reproduce it myself. This is definitely a hack workaround, but have you tried creating a text field on the Task object that has a default value of whatever value you need, and then pass that value into the Email Template?
I suggest you create a utility class that performs your email formula operation to create correct email address links for any objects you intend to send email notices about (be sure to include validation in the class too). You can then call the class from any trigger, other class, etc that needs to use it in order to send an email based on a URL and object that the org has. That should automate the the entire process for you across all of your objects throughout your complete org.