You need to sign in to do that
Don't have an account?
SF DEV
addError in Trigger with hyperlink
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>');
Try downgrading to 26 or some lower version.
All Answers
Try downgrading to 26 or some lower version.
Thanks Rahul, yes i changed to 26 version...
I was wondering if we could log this issue to salesforce known issues.
Yes, we have too..
I've been trying to figure this out for a couple hours now (still new to APEX development).
Thankfully after plundering through post after post I found this. Changing the API version fixed the problem and now my contact shows up as a hyperlink, whereas before the html markup showed up as text.
Thanks so much!
I tried this and it is working in browser but it is not working in Salesforce1 app. 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.
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>';
// The below statement add error in the screen
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.
We are facing the same issue in Salesforce1 app. Did you find a solution?
Not yet. I have contacted Salesforce R&D, they told me that it is a limitation in Salesforce. This cannot be done in mobile version with this approach.
To show html link or any thing else you need to write addError as below :
a.addError('This ID is already being used in Account:<a href="any link" >test name</a>',FALSE);
Hope this help you.
Thanks
khillan