Adapter for Salesforce 8.2 | webMethods Adapter for Salesforce Documentation | webMethods Adapter for Salesforce Installation and User’s Documentation | Adapter Connections | Dynamically Changing a Service's Connection at Run Time
 
Dynamically Changing a Service's Connection at Run Time
You can run an adapter service using a connection other than the default connection that was associated with the service when it was created. To override the default, you must code your flow service to pass a value through the pipeline into the adapter service's $connectionName field.
For example, you have a flow service that creates a new account for the Account Salesforce object in the Salesforce.com production area. However, for testing purposes you want the flow service to have the capability to create the account in the Salesforce.com Sandbox. At run time, you want the flow service to determine programmatically whether to create the account in the production area or the Sandbox. Set up your flow service to have a Target variable so that it can branch its logic based on the value in Target:
*If Target contains the value production, the flow service does not specify a value for the $connectionName pipeline variable, which causes the adapter service to use its default connection to the production area.
*If Target contains the value test, the flow services sets the $connectionName variable to the connection for the Sandbox so that the adapter service creates the account in the Sandbox.
Alternatively, you can use the configured connection for an adapter service, but at run time override the Salesforce.com user credentials defined in the connection. To override the user credentials, you must code your flow service to pass values through the pipeline into the adapter service's username and password fields.
Note:
When using the Salesforce.com OAuth connection for an adapter service, changing the OAuth connection user credentials (username and password) at runtime causes the adapter to create a normal Salesforce.com connection with these credentials.
For more information, see Changing the Connection Associated with an Adapter Service at Run Time.