Search
  • Ravi Sharma

Create & Connect Salesforce External Objects to OData 4.0 APIs

Updated: a day ago

Great news! Now you can create OData service using our Ignite platform and exchange data with your Salesforce Organization using OData 4.0


We will divide this section into two parts:

  1. How to create an OData service in the Ignite platform.

  2. How to connect your OData APIs to Salesforce.

To create an OData workflow compatible with Salesforce Connect (External Object Connection), you will need our Ignite-OData and Ignite-sequelize nodes.


These steps are also mentioned in the OData node's help section and in our tidbits YouTube video which can be found here.

1. Let's dive in and create an OData service from scratch inside of our Ignite platform.

To create an OData service we will need an API endpoint to serve the incoming requests, which we can create using the http-in node.

Go ahead, drag and drop a http-in node and configure it. To make it compatible with incoming OData requests which comprises of dynamic URLs, you need to append a /Root/* or /Serviceroot/* variable to the endpoint. This endpoint will now serve all the incoming get requests matching in Serviceroot/ or Root/.


Note: To enable your service to perform upsert operations, you will need to add a few other http-in nodes to support requests with other http verbs (Post Put Patch Delete).


Going forward you will need to provide a database model for your service to serve incoming metadata requests. This can be achieved using a function node, setting the msg. model property to a valid model and adding a wire from http-in nodes to the function node. See the example below.

var model = {
    namespace: "odata",
    entityTypes: {
        "users": {
            "id": {"type": "Edm.Int32", "key": true},
            "fullname": {"type": "Edm.String"},            
            "username": {"type": "Edm.String"}            
        }
    },   
    entitySets: {
        "users": {
            entityType: "odata.users"
        },
    }
};
msg.model = model;
return msg;


Next, drag and drop an OData-in node and connect a wire from the function node to the OData-in node. Great job, we are halfway through now!


Drag and drop an Ignite-Sequelize node and connect a wire from the OData-in node to the Sequelize node. Configure your Sequelize node and provide your database connection variables.


Now that we have data, we need to enable our workflow to give us an OData compatible response. In order to do this add an OData-out node to your flow and draw a wire from the Sequelize node to the OData-out node.


Once you reach this step, give yourself a pat on the back. Now all you need to do is add an http-response node to send that response back to the client.


Click the "Deploy" button and your shining new OData service workflow is ready. You can now use postman client to see your service in action. See an example here.


Now that your service is ready, you can use it to exchange data between your service and your Salesforce Organization which we will do in the next part of this post.

2. Connect and configure your service in Salesforce External Data Source.

To be able to create and configure an external data source, you must Set up Salesforce Connect. This trail on trailhead.salesforce.com will walk you through the necessary steps.


Once you have installed the necessary packages into your Salesforce Organization, follow the steps below to configure your OData service inside Salesforce CRM.


From Setup, type External Data Sources into the Quick Find box, then select External Data Sources.


Click New External Data Source.

Enter a valid label for your external data source.


Select Salesforce Connect: OData 4.0 as the type.



Now, provide your service URL with the endpoint in the URL field and click Save when you're done. Note: You should check the Writable External Object only when you have added http-in nodes with POST, PUT, PATCH, DELETE methods which enables Salesforce to write records to the database.


Phew! That was tricky, but stick to the steps because we're almost there.


Now that we have an external data source, we need to sync the tables/metadata to create objects inside of our Salesforce Organization. which can be easily done by clicking the "Validate and Sync button."


Remember the model we provided in step 1?


Here, you'll see a list of all the tables that you provided metadata for inside of the function node.


Check all the tables you want to sync with Salesforce and click the Sync button



Have you done that? Well then congratulations! You've successfully added your OData service as an external data source inside your Organization.


To confirm if the objects have been created inside Salesforce, click the drop-down arrow next to the Object Manager, Here you'll see the tables that you just synced.



Hooray! We're done and the end result is even sweeter than you expected.

  • Play around with these objects and configure them according to your needs.

  • Create custom tabs to view external data.

  • Use your tabs to read, write, update and delete data directly from Salesforce Organization to your database.

  • Perform full CRUD operations from Salesforce to your external database.

  • Use these objects to feed data to your reports and decorate your dashboards to give useful business insights.

  • Data from your database will directly populate your dashboards in real-time.


Additional links:

To perform CRUD operations on your database, try creating a custom tab. Follow this trail's "View External Data" section to create custom tabs.

You can also find a trail on how to prepare reports and dashboards here.

Recent Posts

See All

Ignite Platform Deployment Models

Most modern cloud products support various deployment models (e.g. public, private, hybrid). Typically, for SaaS tools, all data at-rest, and in-transit, flows through the vendors cloud. However, Igni

© Cyber Group Inc, 2020