based on a field value as null on account I'm showing up a toast error message as below:

if(field == null) {
            console.log('comin inside field null')

            var resultsToast = $A.get("e.force:showToast");
                mode: 'sticky',
                type : 'error',
                message: ' field on account should not be null!',
                messageTemplate: 'The field on account should not be null. Please update it here {1}!',
                messageTemplateData: ['Salesforce', {
                    url: 'https://***--***.lightning.force.com/lightning/r/Account/'+ accountId +'/view',
                    label: accountName,



This is showing two error messages like:

enter image description here

If I write a normal toast messgae, its showing just one error pop up, but I need to display the account link on the toast message, what is wrong in this code. Please advise.

  • need more code to know, looks like the method is executed twice, once with the account variable, the other without....so, its most likely your logic that is flawed. – glls Sep 20 '19 at 0:07
  • @glls I am able to fix it now, I have put if opp != null then it will execute, the first time its taking opp and all other fields null so may be that's why. Thank you for your comment. – user905 Sep 20 '19 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.