function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
d.sureshkumar41.33978150573839d.sureshkumar41.33978150573839 

URGENT HELP

I WANT THE NAME AS LINK TO OPEN THE LEAD RECORD. BUT IT IS COMING AS HARD CODED.

 

 

 

 

trigger TriggerOnLead on Lead (before insert) {
 
    Map<String, Lead> mapLead = new Map<String, Lead>();
    
    for (Lead lead : System.Trigger.new) {
          mapLead.put(lead.Email, lead);
    }
    
    for (Lead lead : [SELECT Id,Name,Email FROM Lead
                      WHERE Email IN :mapLead.KeySet()]) {
        Lead newLead = mapLead.get(lead.Email);
       newLead.Email.addError('<a href="https://ap1.salesforce.com/'+ lead.id +'">Agency Name '+ lead.name + '</a>');
       
    }
}

 

 

 

 

Suresh RaghuramSuresh Raghuram

string i =string.valueOf( lead.id);

 

string url= 'https://ap1.salesforce.com/';
string urlPath = url + i;
newLead.Email.addError('<a href="urlPath">Agency Name '+ lead.name + '</a>');

you may need to make some more corrections to get the correct syntax of what i suggested.

when u put some thing in qotesit will take as a string instead looking for its api name and the value in the field. I did not come across using anchor tag in the trigger. any way all the best.
if this answers please make this as a solution. and give kudos.

'