+ Start a Discussion

Help with display of error message

I'm a newbie here. Maybe its a simple silly thing..but please help!
> There is a custom object, say Student__c. There is a field called 'Account Number__c' in this object. 
> On record creation and update, I need to check if this 'Account number' is present in another object (Background Check__c). If present, I need to show a warning message (The orange colour one). 
> I'm using a trigger which calls an apex class and is checking the field using DML.
> Also I created a VFP to just display the error message ( Using apex pageMessages)
> I'm unable to pass error message from this trigger to VFP.
> Is there a way to do so ? (I don't want to use .addError)
> Or, is there a way that I can directly call an apex class from my VFP wihtout a button (Since VFP is only for display of error message, there is no button)

Please help!