I want a user to be able to create new new record for an object, but then be shown a message and not the inserted record itself, is there a method I can use for displaying a message other than addError()?
|
|
Displaying a Message After Insert To allow a user to create a new record, but then see a message instead of the record you'll need to implement a VisualForce page using a controller extension, where the extension takes care of saving the record and then toggling a public variable used to control the onscreen display. Some rough page could look something like this:
Now you could add a new information message to be displayed when you save the record:
Or, redirect them elsewhere via the Note, this code isn't tested, it's just been written in browser! Reporting Errors From Triggers (old answer) If you're looking for an alternative to using First define a new exception class:
Then throw a new instance of this exception where you want things to grind to a halt:
|
||||
|
|