If you are using outbound messages in Salesforce which send data to external applications, the biggest challenge is that when you do any testing in your sandboxes, your external applications gets bombarded from your test messages. This causes unnecessary problems for external applications resulting in problems and temporary fixes. So the question is how do i prevent my outbound messages from my sandbox not to fire at production external applications?
Use formula field on user object
Since outbound messages do not have any criteria to use salesforce environment variables, it is really hard to stop outbound messages to fire on sandboxes. So to solve, this the best way is to create a formula field on the user object called IsSandbox. Since the organization id is fixed for production, the formula field checks for the organization id and if it matches the production id, we call it false and other wise, it would be a sandbox. The below screens shot explains the logic to check for sandbox.
Create criteria condition on workflow rule to prevent outbound message
The next step is to create a workflow rule which would fire the outbound message action only if the IsSandbox variable is false. So the outbound message will only get fired on production and it will not fire on sandbox environment.
The ideal scenario would be to create a custom setting to change end points based on environments. But it is still an idea in idea exchange waiting to be released to production. Please feel free to post your thoughts on how do you handle this now in your environments or email me at firstname.lastname@example.org for further questions.