• Srini Konduru
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

Hi,

I developed a trigger on Opportunity and if the validation in trigger pass then I am displaying an error message on the top and provide a link to that error message using href tag. Please find below the code.

String sBreak = '</br>';
               String first = '<a href="';
               String fullFileURL = URL.getSalesforceBaseUrl().toExternalForm();
               Schema.DescribeSObjectResult r = Contact.sObjectType.getDescribe();
               String keyPrefix = r.getKeyPrefix();
               String Relatedlist = '?rlid=RelatedContactList&id=';
               String link = '" onclick="_gaq.push">';
               String Errormessage = System.Label.Key_Contact_Error_Message;
               Link = Link + System.Label.Key_Contact_Link;
               Link = Link + '</a>';

                Opptys[0].addError(Errormessage + sBreak + first + fullFileURL + '/' + keyPrefix + Relatedlist + AccountIds[0] + Link, false);

This is perfectly working in normal browsers but not working in Salesforce1 app. Can any one please help me in this.

Unable to get hyperlink in add.error code, In trigger.

 

I have seen codes in forum, but wrkg out, as its giving like output text, i need in clickable format.

 

i tried this:

o.addError('ERROR TRM100: There is already an identical record: <a href=\'https://cs2.salesforce.com/' + Acctid.id + '\'>Record Number ' + Acctid.id + '</a>');

 

  • March 14, 2013
  • Like
  • 0