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
DTRain521DTRain521 

Display a message from a trigger

Hello,

What would be the best way to display a message while a trigger runs on a Lead before insert or update?  Preferably I would like to have a message display that provides a decision of yes or no.  Yes would return them to the lead record to make other updates, no would save the record.

 

Any help to point me in the right direction would be great.  Code reference would be great.  It seems I learn better from existing code.  :)

Thanks Dwayne

Best Answer chosen by Admin (Salesforce Developers) 
Cory CowgillCory Cowgill

Triggers can not accomplish this. Triggers exeucte at the database level, they do not interact with the UI. The only information you can pass back to the UI via a Trigger are error messages via the Sobject.addError(string) method.

 

For your use case, you will probably need to use Visualforce / Apex Controllers & Extensions. Take a look at the dev guide here ( http://www.salesforce.com/us/developer/docs/pages/index.htm ) . That provides examples on how to create custom VF Pages / Controllers which would allow you to implement your use case.

 

You may be able to accomplish this with some creative Custom Buttons / Javascript also. But you cannot do this inside Triggers.

All Answers

Cory CowgillCory Cowgill

Triggers can not accomplish this. Triggers exeucte at the database level, they do not interact with the UI. The only information you can pass back to the UI via a Trigger are error messages via the Sobject.addError(string) method.

 

For your use case, you will probably need to use Visualforce / Apex Controllers & Extensions. Take a look at the dev guide here ( http://www.salesforce.com/us/developer/docs/pages/index.htm ) . That provides examples on how to create custom VF Pages / Controllers which would allow you to implement your use case.

 

You may be able to accomplish this with some creative Custom Buttons / Javascript also. But you cannot do this inside Triggers.

This was selected as the best answer
DTRain521DTRain521

I had a feeling that I would need to look into such a solution. 

Thank you for your advice.  Gets me going in the right direction.