In this article, we explore how we can create new records for Salesforce Standard & Custom SObjects using SOAP API Endpoints available for the Salesforce Platform.

Prepare Request Object – [With MRU = True]
Step 1. We will use the appropriate SOAP Endpoint in the format to prepare aPOSTrequest by using the following conventions
“<Salesforce Org Host Name>/services/Soap/c/<Salesforce API Version>”
In this demo, this Endpoint URL would be
“https://bansalp-dev-ed.my.salesforce.com/services/Soap/c/47.0”
Step 2. Now we need to prepare the body of the request. Click on “Body”
Step 3. Since this is going to be raw input, click on“raw&rdquo
Step 4. As usual, we need to specify the“SessionId,” which is the security token returned as the response to SOAP Login Request. To more about SOAP Login Request, please refer to my earlier blog: Salesforce SOAP API Authentication: The Login Request
Step 5.The next important thing to notice isMost Recent Update(MRU)Header. Here is a little description of this important parameter:
If MRU Header is set to True, then this newly created record will be displayed under the” Recently Viewed” View of the SObject otherwise, it won’t be available under Recently Viewed records.
For this demo, we will set this value to true
Step 6. Under SOAP Enveloper Body, we will be having a Create Tag
Step 7. Under Create a tag, we will be having subjects Tag; if you notice, we have specified the name of API Name of the SObject for which we adding a new record using this SOAP Request Body. In this demo, we are using a Custom SObject“Invoice__c”
Under SObject Tag, we need to specify all the tags “ONE FOR EACH of the Required Fields” in them as per SObject Schema. These should be in the following format-
<Field-API-Name>Value of the field based on the respective data type of the field</Field-API-Name>
For example. We have the first tag for the Description. Next is for Customer, and so on.
In the Custom SObject “Invoice__c,” we have 3 Required Fields “Description__c”, “Customer__c”, “Amount__c”, and Create/Update request will be successful only if specified all the fields as part of the request body. It holds even if we are updating only one field. We still need to pass on all the request fields to the request body.
Step 8. Include the tag for the “Description__c” field and specified its value as required.
Step 9. Include the tag for the “Customer_c” field and specified its value as required.
Step 10. Include the tag for the “Amount_c” field and specified its value as required
With this, the SOAP Request Body is ready to be posted back to the Salesforce API Endpoint
Step 11. Click on the Send button to submit this POST Request

Analyze Response Object
As long as the POST Request is successful, we would be getting a response object returned. We will explore the response object in the following section-
Step 12. We can see the current usage of the API Requests as per the governor limits of the target ORG. This value represents the total number of API Requests issued already against the target ORG. For demo this, we can see 57 API Requests are already been consumed so far
Step 13. We can see the total number of API Requests allowed as per the governor limits per ORG. For this Developer ORG, this limit is 15000.
Step 14. Shows this information related to the Limits is referring to KPIs of type “API REQUESTS”
Step 15. Response object consists of the “create Response” tag since we send a “create” enveloper in the POST Request
Under “result” tag, we can see two output parameters are included Id: Unique Id for the record & Status: Status of the last operation performed by API Request
Step 16. <id>. Contains the Record Unique Identifier; this is helpful in case we would like to track the records added to SObject
Step 17. <success>. Contains the status of the POST Request. In this case, it is “true,” which shows that the last create operation on the custom SObject “Invoice__c” was a success












Join the conversation! Your thoughts help the community grow.