Adapter for Salesforce 8.2 | webMethods Adapter for Salesforce Documentation | webMethods Adapter for Salesforce Installation and User’s Documentation | Adapter Services | Configuring Custom Query Operation Adapter Services
 
Configuring Custom Query Operation Adapter Services
 
Configuring a Custom SOQL Statement
Configuring a Custom Query Operation Adapter Service
Use the Custom Query Operation template to create a query service that allows you to configure a dynamic Salesforce Object Query Language (SOQL) statement, part of which you set at run time using input fields. At run time, the service will create the SOQL statement by combining the contents of the input fields and then executing the statement. This is useful when you need the flexibility to set all or part of an SOQL statement at run time instead of at design time.
The Custom Query Operation service performs a query against a Salesforce object to find records and return selected field values from those records.
Also, when you configure a custom query, you must provide all the fields of the parent object and then the fields of the child object.
For example, in the following query statement:
SELECT Account.type,Account.Name, Contact.FirstName, Contact.LastName FROM Contact
Provide all the fields of the parent object which is the Contact and then provide all the fields of the child object which are Account.type,Account.Name, Contact.FirstName, Contact.LastName.
Note: 
Ensure that all the fields in the parent object is entered before you enter the fields of the child object.
Input and output parameters for the service are optional. An input parameter is required only when the SOQL statement contains the ? placeholder variable. Each ? in the statement corresponds to an input parameter. For example, in the following query statement:
SELECT ?, Account.Name, (SELECT Contact.FirstName, Contact.LastName
FROM Account.Contacts) FROM Account ?
you should configure only two input parameters, because the statement contains two ? placeholder variables.
You configure an output parameter only when you want to overwrite the default field name in the output result. For example, in the following query statement:
SELECT Contact.FirstName, Contact.Account.Name FROM Contact
if you do not configure any output parameters, the service will populate the output result with FirstName and Name as the parameters in the output IData. If you want to overwrite the default parameters with FNAME and AccountName, set the output parameters to FNAME and AccountName.
You must specify the input and output parameters of the adapter service at design time. When you configure the service, the input fields will contain the input for the SOQL statement. The output fields will contain the results from the result set. Make sure that the input and output fields correctly match those of the SOQL statement. If there is any mismatch, the service will generate an exception at run time.