Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a visualforce page that updates a custom object. After the update an email is sent to a related contact. I have to add a checkbox to the page with which the user can choose to send the email or not. Do I have to create a new custom field on the custom object, save the value of the checkbox, and check that field in the trigger that sends the mail, or is there another way (preferably without a new custom field)?

share|improve this question
up vote 5 down vote accepted

You could use a static property on the visualforce controller (or another Apex class). The value that is set would be available for the duration of the transaction and thus accessible to the trigger. However, once the transaction has completed you would have no visibility that the user ever checked the box, which, from your description, sounds like it wouldn't be a problem.

share|improve this answer
Wow, I did not expect this to work (no offence, of course). Great! Thanks! – Lex Jan 16 '13 at 8:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.