Adapter for Salesforce 8.2 | webMethods Adapter for Salesforce Documentation | webMethods Adapter for Salesforce Installation and User’s Documentation | Adapter Services | Configuring Create Operation Adapter Services
 
Configuring Create Operation Adapter Services
Use the Create Operation template to configure an adapter service that inserts new records into one or multiple Salesforce objects. For example, you might configure an adapter service that inserts new contacts into the Contact Salesforce object, or a service that inserts new records into both the Contact and Account Salesforce objects. The Create operation wraps the create call of the Salesforce.com Web service API.
The Salesforce.com create call returns a SaveResult object. The adapter service returns the information from the SaveResult object as output.
Output Variable
Description
id
String The ID of a newly inserted record.
success
Boolean Whether the create call successfully inserted a record. If success is:
*true New record inserted successfully.
*false New record insertion failed.
errors
String List When success is false, errors provides the error codes and descriptions of the errors that the create call encountered.
The input signature of the adapter service contains the name of the Salesforce object or objects that you selected as input parameters. For example, when you select the Account object, the input signature contains Account as input parameter. Each object is a Document List that holds the field values for the records to insert. At run time, pass the adapter service one Document within the sobjects Document List for each record you want to insert.
The output signature of the adapter service contains a results Document List. Each Document in the input sobjects Document List maps to an output Document in the results Document List.
*To configure an adapter service that uses the Create Operation template
1. Review the steps in Before Configuring or Managing Adapter Services.
2. Start Designer.
3. Right-click the package in which the service should be contained and select New > Adapter Service.
4. Select the parent namespace, type a name for the adapter service, and click Next.
5. Select Adapter for Salesforce as the adapter type and click Next.
6. Select the appropriate Adapter Connection Name and click Next.
Important:
Ensure that the Salesforce.com user account identified by the connection has all the required permissions to insert a record in the Salesforce object that you will select later in the procedure. See Configuring Adapter Services for more information.
7. From the list of available templates, select the Create Operation template and click Finish.
The adapter service editor for the adapter service appears. You can select the Adapter Settings tab at any time to confirm adapter service properties such as the Adapter Name, Adapter Connection Name, and Adapter Service Template, as necessary.
8. In the Select column on the Schema tab, select the check boxes for one or more Salesforce objects into which you want to insert new records.
9. To use an External ID for a Salesforce object, select the check box for the Salesforce object in the Show External ID column.
10. To identify the fields to include in the new records:
a. Select the Create Operation tab.
b. Click the icon to populate the table with the creatable fields of the selected Salesforce objects.
c. For each field that you want to include in the new record, select the check box in the Use Field column.
For example, if you are defining an adapter service that inserts records into the Account and Contact Salesforce objects, you might define the adapter service to provide values for the Account.Name, Account.Type, and Account.ParentId fields, and the Contact.LastName and Contact.FirstName fields.
The fields and the objects become part of the input signature for the adapter service. When invoking the adapter service, pass the values for these fields as input. The adapter service uses those input values when creating the new records.
Important:
Be sure to select all required fields for a record and all fields required to maintain the referential integrity of the Salesforce object.
Note:
The Create Operation template does not list fields that are automatically created when a new record is added, for example, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, and SystemModstamp. Although you cannot select these fields, they will be included in new records. Also, the Create Operation template shows only those fields that are marked "creatable" for the create operation.
At run time, the adapter service determines whether the values specified for the fields are valid, for example ensuring that a date value is specified for a field that has a java.util.Date data type. If an invalid value is detected, the adapter issues an error message and does not attempt to insert the new records.
d. To create a record in a table that has a reference to a record in another sObject, select the fields in an sObject designated with External IDs. The Relationship Name column shows the sObject record that the selected External ID field relates to. For information about how to assign an External ID to a record field, see Assigning External IDs to sObject Record Fields.
11. Select File > Save to save the adapter service.