In this chapter, we will learn about one of the operation types which is “Operation PullQuery”.
What is pullQuery? #
When we query data we get a result and then next time we query again we get the same result and it sends to the client again. So the pullQuery is used in combination with an outbound interface and it is used within interface outbound scheduler, we have a schedule that can execute the outbound interface, select the data and send the data to the receiver. Here we use pullQuery operation like we don’t want to send save data again which is sent once already. So by this pullQuery operation, we will send data only once. For this, we need to create a custom field on account salesforce object.
2.1 How does pullQuery works? #
The procedure is given below:-
Pre-Requisite:-
- Create Integration.
- Create Adapter- SFDC2SAPPI.
1. Create an Outbound interface:- #
- Interface Direction – “OutBound”.
- Operation Type – “pullQuery”.
- Click on Query Editor
- Enter Query as per requirement.
- Save SOQL.
- Select Inbound Interface ID in “Response Interface”.
- Select Outbound Adapter.
- Select Invoke Outbound/Inbound Interface.
- Select Processing mode – “Asynchronous”
- Click on Do Mapping.
- Save Mapping.
2. Create an Inbound interface:- #
- Interface Direction – “Inbound”.
- Operation Type – “Upsert”.
- Click on Do Mapping.
- Create Formula in the sentToSAP field.
- Click on Save.
- Run the “Interface Execution Scheduler”.
Open Developer Console and run the code given below:- #
skyvvasolutions.CallOutControl c=new skyvvasolutions.CallOutControl();
c.returnxml=true;
c.returnListRecord=true;
c.iscreatemessage=true;
List<String> lId = new List<String>();
lId.add(‘0017F000009gT11QAE’);
for(Account a : [SELECT Id FROM Account]){
lId.add(a.Id);
}
skyvvasolutions.IServices.invokeCallout2(‘PullQuery’,’Outbound’,lId,’SYNC’, c);
Check the result in Message Monitoring:- #