The Salesforce adapter for SAP PI/PO or CPI generates schemas for multiple Salesforce objects, this simply integration efforts for use cases where there are multiple objects that have to be created in specific order and where relationship has to maintain from parent object to child objects. The multiple objects schema eliminates the need for complex BPM or iFlows as all the logics can be specify in the message mapping. The adapter takes care of the processing of the different object types in the order that was generated with the schema. As an example, one can create a multiple schema with the Order and OrderItem objects. This schema allows one to map a payload that has Order and OrderItem records. At runtime the adapter will send first Order records to Salesforce, wait for response and then process OrderItem objects. This means there are multiple API calls to process the payload.
However, in certain use cases, one may want to send the whole payload to Salesforce, this reduces the number of API calls and improves the processing time as the adapter will send the whole mapped payload to Salesforce in one single API call. To do this, one has to expose a APEX REST service on Salesforce side. As this means custom development, Advantco created a Workbench that can expose any number of objects as a REST endpoint without the need to write a single line of APEX code.
APEX Add-on Workbench
The main feature of the Workbench is to generate the APEX class that is required to expose a REST service. This REST service can have multiple objects and can be easy create with dragging an object from the list and drop it in the selection box. The Workbench handles both standard as well custom objects.
Step 1: Select objects to expose the functionality of the REST service.
In this example, we want to expose a REST service to create an Order with OrderItems in Salesforce.
Step 2: Generate the APEX class
Once we select the objects that we want to expose with the REST service, we generate the APEX class. We provide the URI for the new REST service as part of the generation step.
Step 3: Deploy the APEX class
Deploying the new APE class will make the new REST available for Salesforce adapter to consume this new REST service from SAP PI/PO or CPI.
Consume the APEX REST service from SAP CPI.
The new APEX REST service can be easily consume from SAP CPI. Create an iFlow with a receiver channel using the Salesforce adapter type. Select ‘Apex REST Web Service‘ as Message Protocol.
Specify the endpoint of the REST service.
Consume the APEX REST service from SAP PI/PO.
Select ‘Apex REST Web Service‘ as Message Protocol and specify the REST service endpoint.
Implementing custom APEX REST service is a cumbersome task, requiring APEX skillset and is subject to constant maintenance effort. With the APEX Add-on, at Advantco we try to make this process a simple 3 steps process that can generate REST services that is based on the standard or custom objects defined in the Salesforce instance.