You need to sign in to do that
Don't have an account?
ministe2003
Apex page messages on standard salesforce pages
Hi all,
Writing some apex which converts an opportunity to another custom object of mine, and it acts upon a button press. When it fails I want to display page messages to inform the user why it failed. However, with it being a standard page I dont seem to be able to do it. In a custom page obviously I'd just stick in the <apex:messages /> tag but with this being the standard Opportunity page, how can I display messages?
Thanks!
Steven
Try implementing the validation via an apex trigger, add in it the logic to check the validation and in case of the validation failing raise error with add-error method. Please refer the following for reference:-
if(strAcctRecTypeName == 'Limited Partner') { if(strPAccRecTypeName != 'Institution') { Trigger.new[0].parentId.addError('A '+strPAccRecTypeName+' cannot be the Parent of a Limited Partner. Please select an Institution instead of a '+strPAccRecTypeName+'.'); } }
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
All Answers
Try implementing the validation via an apex trigger, add in it the logic to check the validation and in case of the validation failing raise error with add-error method. Please refer the following for reference:-
if(strAcctRecTypeName == 'Limited Partner') { if(strPAccRecTypeName != 'Institution') { Trigger.new[0].parentId.addError('A '+strPAccRecTypeName+' cannot be the Parent of a Limited Partner. Please select an Institution instead of a '+strPAccRecTypeName+'.'); } }
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
addError? does that work differently to the apex page messages? I might try that in future, for now I just direct the user to another custom page with the error.
Thanks
Steven
What about a success message?
that is exactly what I am trying to do!! I keep seeing comments about using triggers and error messages but how about just a friendly "request submitted" type of message on a standard saleforce page (one where you can't edit the visualforce code)..
Good luck!
Hi,
Were you able to achieve this? displaying a success message on top of a standard salesforce page?