Salesforce create service

Salesforce Create Service

The Salesforce Create Service can be used to create one or more new Salesforce records of the specified Salesforce object type.

This component has the option of either using the specified ConnectMessagePart body to create new records or using the headers in a ConnectMessagePart to create a single new record.

So it is possible to create more than one record (up to a limit of 200 records) in a single transaction when using the ConnectMessagePart body. This is important because Salesforce limits the daily number of API calls a client application, such as the ConnectAgent, can request from the Salesforce servers.

When using the ConnectMessagePart body, we use XML to specify the new records. For example, an incoming ConnectMessagePart might have the following XML body:

<records>
    <record type=”Account”>
        <field name=”Name” value=”foo”/>
        <field name=”Rating” value=”Hot”/>
    </record>
    <record type=”Account”>
        <field name=”Name” value=”bar”/>
        <field name=”NumberOfEmployees” value=”42”/>
    </record>
</records>

The top-level element is always records when creating multiple records. However, if you create a single record, you can have record as the top-level element. For example, the following would also be valid:

<record type=”Account”>
    <field name=”Name” value=”foo”/>
    <field name=”Rating” value=”Hot”/>
</record>

The records element can have multiple record subelements. Each record always has a type attribute. Note that you cannot create records of multiple different types in a single batch. So each record must have the same type.

Furthermore, each record has zero or more fields. Each field must have a name and value attribute. It is possible to update different fields in different records in a single transaction as long as the records are of the same type.

After executing the request the service returns the ID(s) of the created record(s) in the body of the outgoing ConnectMessagePart. If there is more than one ID, this will be a comma separated list of IDs.

Finally, see the article on authentication for the different available options as well as their corresponding requirements.