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

Externalized endpoint URL for workflow outbound messaging in a managed package?

I'm currently looking at the outbound messaging feature of workflow as a way to propagate a limited subset of state to an external system as part of a composite application.  Basically the state that will be propagated is configuration data for a resource-intensive application with a app as the user-facing configuration UI.  I could obviously do this myself using post-DML triggers and callouts, but since outbound messaging already has delivery tracking and retries, I'd prefer to use the features of the platform when possible.


This functionality will be rolled into a managed package, and the endpoint URL may vary by customer based on region or other variables.  As far as I can tell at a glance, the endpoint URL is fixed as part of the metadata definition of the workflow, though.  If I were doing this using post-DML triggers and callouts, I'd have the callout URL be stored in a custom setting (and of course established as a trusted callout endpoint).


So with all of that explanation and prefacing out of the way, does anyone know of a way to use outbound messaging with an externalized endpoint URL?





There is a difference between the endpoint URLs (webservices) you use for outbound messages and apex callouts.


Say you have created a webservice and exposed it to the web.

You can use the endpoint of this webservice to be used in apex callouts.


But you cannot use this endpoint URL for outbound message. What you will have to do is

1) Once you create the outbound message you will get the link 'Click for WSDl' using which you need to download the wsdl.

2) Using this wsdl you need to create a listener which is similar to webservice but will take the soap notification sent from salesforce as input.

3) Once you create the notification listener you have to expose it to the web and use its endpoint URL for outbound messages.


In your case the best way is to go for apex callouts.


Let me know if you have any doubts.


Thanks for the reply.  Yes, I'm aware that outbound messaging is actually creating a WSDL for my event listener.  Our current product does the exact same thing for one of its outbound integration services.  I have no problem with that at all.  My issue is specifying the endpoint URL for that event listener on a customer-by-customer basis in a managed package delivered through the AppExchange.


I'd prefer not to have to resort to my own trigger/callout-based data sync because of the need to write a guaranteed, ordered message delivery mechanism when the platform pretty much supports this already.  Also, I attended a session on this exact topic at DreamForce and saw the huge number of workarounds needed to implement such a feature due to all of the various governors and other restrictions.


Is it possible to create workflow metadata programmatically using either the metadata API or Apex?  If so, I could forgo including these in the managed package and create them post-installation after the endpoint URL has been specified for that exact customer.


Thanks again!