How to show the message in hyperlink

showToast : function(component, event, helper) {
var toastEvent = $A.get("e.force:showToast");
    "title": "Success!",
    "message": "The record #123456 has been updated successfully."

the '#123456' should be in hyperlink.

  • 1
    I don't think you can show links in the toast? The documentation doesn't say you can.
    – sfdcfox
    Nov 14, 2016 at 6:59
  • 1
    @sfdcfox but the release doc says its available in summer 16 releasenotes.docs.salesforce.com/en-us/summer16/release-notes/… Nov 14, 2016 at 7:00
  • 1
    That's curious. There's no mention in the documentation, as the release notes state there should be. Perhaps someone knows something. Definitely a good question.
    – sfdcfox
    Nov 14, 2016 at 7:04

2 Answers 2


You can provide an 'action' in the messageTemplateData provided to the showToast event. Here's an example where the link's action becomes creating an event which will trigger a second toast.

showToast: function(component, event, helper) {
    var toastEvent = $A.get("e.force:showToast");
        title: "Success!",
        mode: "sticky",
        message: "has to be defined due to toast event validation, but isn't used.",
        messageTemplate: "The record '{0}' has been updated successfully.",
        messageTemplateData: [{
            url: "#123456",
            executionComponent: {
                descriptor: "markup://force:showToast",
                attributes: {mode: 'sticky', message:"second toast"},
                isEvent: true,
                isClientSideCreatable: true,
                componentName: 'showToast'
  • This is excellent... but how do I make that link navigate to the desired url? Jan 16, 2017 at 20:28
  • 1
    You could have your own custom event you put in the action (instead of the second showToast). Then have your component handle that event and in the handler set window.location (if you really want to navigate to a new page), but with the lightning experience you should ideally just load the new component or lightning page that you are trying to get the user to go to Jan 19, 2017 at 22:10
  • is there documentation around the "executionComponent" syntax anywhere? I cannot seem to figure out how to trigger a custom event - ex: { descriptor: "markup://myNamespace:myEvent", attributes: { att_1: 'foo', att_2: 'bar' }, componentName: 'myEvent', isEvent: true, isClientSideCreateable: true } Aug 16, 2018 at 19:37
var resultsToast = $A.get("e.force:showToast");
                    mode: 'sticky',
                    message: 'This is a required message',
                    messageTemplate: 'Record {0} created! See it {1}!',
                    messageTemplateData: ['Salesforce', {
                    **url: 'https://xx-dev-ed.lightning.force.com/one/one.app?source=alohaHeader#/sObject/'**+recId,
                    label: 'here',


The url currently is hardcoded, but can be removed programetically

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .