Scope of Message Objects
The message objects can only be instantiated from PeopleCode. These objects can be used anywhere you have PeopleCode, that is, in Component Interface PeopleCode, notification PeopleCode, record field PeopleCode, application engine PeopleCode, and so on.