You need to sign in to do that
Don't have an account?
NinetaM
Can I embed html in the message of a Custom Exception?
I have a custom Exception with a custom Message defined. I would like to send in an HTML string to MyDateRangeException (code below) for some special formatting and so that it might contain some links. Is that possible?
(I am using this exception from a trigger, so I don't have the option of doing anything in the page. Also, cannot use addError because this message will not necessarely refer to the current record being inserted or updated).
public with sharing class MyDateRangeException extends Exception {
public MyDateRangeException(String badRangeDates, String moreInfo) {
this.setMessage((moreInfo == null?'':moreInfo)+' A date range was not met: '+ badRangeDates);
}
}
(I am using this exception from a trigger, so I don't have the option of doing anything in the page. Also, cannot use addError because this message will not necessarely refer to the current record being inserted or updated).
public with sharing class MyDateRangeException extends Exception {
public MyDateRangeException(String badRangeDates, String moreInfo) {
this.setMessage((moreInfo == null?'':moreInfo)+' A date range was not met: '+ badRangeDates);
}
}
Depending on how you are handling the exception, maybe you could add additional properties to the custom exception that expose the required URLs. You could then use custom Visualforce to display those URLs as links in a safer way.
Sounds like what I am trying to do might not be possible nor desirable.
You can add link in your message,However when you need to display the message in VF page you need to add your code as below . After this you can add code in your error message like below .
Let me know if it helps !!
Thanks
Manoj