You need to sign in to do that
Don't have an account?
JNic
Hyperlink in a Trigger Error Messages
Hey guys,
Can you provide a hyperlink or a link to a URL through a Error message displayed as part of a Trigger?
For example, instead of hardcoding the URL as shown below, use a markup to make it a link:
c.addError('ERROR TRM100: There is already an identical record: Record Number '+cs.Number+' (https://na8.salesforce.com/'+cs.Id+')');
This currently reads as:
Error: Invalid Data.
Review all error messages below to correct your data.
ERROR TRM100: There is already an identical record: Record Number 60311 (https://na8.salesforce.com/500M0000000mJJ9IAM)
It would be great if I could make the "Record Number 60311" a hyperlink.
Any idea is greatly appreciated.
Thanks,
I assume you could just add some basic html in to your error message:
Also make sure that in the <apex:pageMessages> element that you specify escape="false".
Hope that helps.
-Victor
All Answers
I assume you could just add some basic html in to your error message:
Also make sure that in the <apex:pageMessages> element that you specify escape="false".
Hope that helps.
-Victor
Thank you Victor,
The simple html markup wortiked. However when I added some styling attribute to it (style=color:1B2BE0) the coloring that I was looking for only displayed correct at Trigger.IsUpdate. When addError was executed on Insert of the record, the correct color was not displayed.
Do you know why the correct color is not being displayed on Insert of the record? Here is the code that I used:
it looks like you just forgot to add the parentheses around the style attribute.
The code below should work:
The hyperlink works fine but after adding the '' per above, the hyperlink color was black by default.
The link works and is intuitive enough.
Thank you,
thnx vhanson222 its save my tym and working awesome
very helpful
hey vhanson222, any idea if we can display this error message with a hyperlink on the salesforce standard UI instead of a visualforce page? I tried but in vain, it simply displays html markup as plain text in the error message!
Aren't you missing a ')' at the end of the line before the semi-colon?