In this chapter, we will learn about one of the operation types which is “Operation query All”.
What is a Query All? #
Query All means querying the data from a client by using Soap UI or postman and when we use postman we use rest version and for soap, we use search service API. Querying data is using SOQL statement, We can write SOQL by entering into the outbound interface or using the query editor, and this way we can generate SOQL statements in our outbound interface.
It gives the response as a JSON to the client if we call using Soap UI or by the postman, we can put different conditions or requests. But the main reason or requirement is query data.
1.1 We have 2 possibilities for query All operation:- #
1. Query operation without mapping will give raw data as a result.
2. Query operation with mapping will give enhanced data as a result.
1.2 How does query All works? #
The procedure is given below:-
Pre-Requisite :-
- Create Metadeta provider.
- Create Istructure Repository.
- Create Message type e.g AccountMT is the parent of ContactMT.
- Create Integration.
1. Create Outbound Interface then select Status is Deployed and Operation Type with Query All (As shown in the picture given below)
2. Add Metadata Provider, Istructure Repository, Message Type for interface(As shown in the picture given below):-
3. Add SOQL Query for interface(As shown in the picture given below):-
– SELECT Id, BillingCity, BillingCountry, Name FROM Account ALL ROWS : means query all the data that exist in salesforce and even deleted data from
salesforce (recycle bin)
– SELECT Id, BillingCity, BillingCountry, Name FROM Account : means query only data that exist in salesforce
– SELECT Id, BillingCity, BillingCountry, Name FROM Account WHERE isDeleted = true ALL ROWS : means query only data that delete from salesforce
4. Do tree mapping field Salesforce object map with Message Type step by step with the level (As shown in the picture given below):-
5. Navigate to Postman application.
6. Create a new request and a new folder.
7. Change method GET to POST and enter Salesforce classic URL with /services/apexrest/skyvvasolutions/SearchService (shown in the picture given in point 8).
8.Click Body tab => click raw tab => select JSON (application/json) in picklist => Create rest body
The body is shown below in the picture.
{
"INTEGRATIONID" : "xxxxxxxxxxxx",
"INTERFACENAME" : "xxxxxxxxxxxx"
}
9. Click Header tab => enter Authorization for Key cell => create Bearer with sessionId.
(As shown in the picture given below).
10. Click Send button to get response data.
11. Here is the result of the responded JSON data.
- The highlighted Account is the deleted account which shows that Query All operation works fine.
- Here is the same Account in the Recycle bin.