function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Strat123Strat123 

Message on Record Question

I have a trigger which I can call after and before insert. I needs to warn or show a message to a user if record inserted fulfills the set of conditions.(I dont want to use addError). How can it be achieved? could not find reference as to how to show custom visual force page, thru pop or redirection(which ever works) .

bob_buzzardbob_buzzard

You can't send the user to another page from a trigger I'm afraid, addError is the only way I know of to send messages back to the user.

aballardaballard

Assuming the insert is happenning as a result of a visualforce action, you should be able to test for the error in the action processing, and redirect from there. 

 

(If you add the error via addError in a trigger, you can test for it via ApexPages.hasMessages or ApexPages.getMessages.)

 

 

Pradeep_NavatarPradeep_Navatar

There is no other way to show message except adderror() method. you can show popup as a visual force page using javascript function.

 

var url = '/apex/ma4';

window.open(url,"HomePage","resizable=yes,status=yes,scrollbars=yes,width=400,height=200,target=_blank")

 

Hope this helps.

hector.asp2hector.asp2

Hi,

 

how can I  call javascirpt call to show pop up alert box  from inside the trigger?

 

Thanx

Hector....

bob_buzzardbob_buzzard

You can't call javascript from a trigger, as triggers have no knowledge of where they were invoked from - UI, dataloader, webservice etc.