I have a production salesforce instance sending outbound message to production Endpoint URL. However, upon sandbox refresh, the outbound message will be copied to sandbox, which results in outbound message from sandbox sent to production Endpoint URL.

What's the best way to deal with this situation?

I have three ideas:

1. Let the server to distinguish production vs sandbox.

Server may determine where the message came from based on EnterpriseUrl field. If this field starts with https://cs, it is from sandbox. Likewise, if this field starts with https://na, it is from production.

2. Take advantage of Custom Settings.

Try to set Outbound Message Endpoint URL with the URL defined in the Custom Settings. Unfortunately, it does not seem to work. Any ideas on this approach?

3. Change the Workflow Rule to only send Outbound Message from production.

In the workflow rule, specify a criteria, where the Org Id has to be the same as the production Org Id. Otherwise, don't send outbound message.

This idea is explained in the following blog:


Any suggestions?

  • The server can check the orgId in the message and only process messages from the production org.
    – superfell
    Commented Mar 20, 2014 at 15:46
  • @superfell Surprisingly, OrganizationId field in the outbound message is OrganizationId as shown here: success.salesforce.com/answers?id=90630000000gtwDAAQ
    – Mingyu
    Commented Mar 20, 2014 at 16:32
  • @superfell EnterpriseUrl does contain the correct OrganizationId
    – Mingyu
    Commented Mar 20, 2014 at 16:33
  • there's a separate orgId field in the message
    – superfell
    Commented Mar 20, 2014 at 16:42
  • Just realize the OrganizationId field contains 18 digit Org Id, not 15 digit Org Id. But that's good enough.
    – Mingyu
    Commented Mar 20, 2014 at 17:18

2 Answers 2


If the sandbox has to be used for outbound message testing or flow between boundary systems(integration), then you will have to change the URL's to a test instance of the external system.(In this case you need to manually change the URL's for sandbox as soon as the refresh is complete and you release it for users)

If you are not using outbound messaging in your sandbox for integration testing then I would recommend to use Org Id check in the Rule criteria.

Also during development, you need to put the sandbox ORG ID in the filter criteria and you will have to change it manually during deployment via UI or in METADATA.

Hope This Helps !!!


My final solution:

  1. Add filter in Workflow Rule so that only production instance sends out Outbound Message

    $Organization.Id = myOrgId
  2. Add logic in Server

    Check OrganizationId field in Outbound Message

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .