Preventing outbound messages to hit your production orgs when you refresh your sandbox..

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.

SandboxUserFormulaField                 SandboxUserViewV1

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.

SandboxDontSendOrderData

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 buyan@eigenx.com for further questions.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Get free tips on Salesforce
Get free tips on Salesforce
We respect your privacy.