+ Start a Discussion
cesces 

Injecting javascript in apex trigger

Hi,

I'm a newbie in APEX. I would like to ask if it's possible to add a javascript inside a trigger. Say for example, I want to add a javascript alert() when the save button of Account is clicked. Is this possible? If it is, can you share me some examples?

Your help will be greatly appreciated.

Thanks a lot,
Ces
mikefmikef
Nope.
Apex trigger is really for data manipulations and shouldn't be used for UI notification.
Visualforce is the technology that you want to use if you want a rich UI experience.

Now with that said there is a way to prevent a save with Apex triggers, but you don't get a pop-up.

Please take a look at the Apex docs, at the SObject method addError().
There are lots of examples on how to use this method.