Skip to Content
Technical Articles

Extending Open Connectors – Salesforce sobjects, Custom Objects, Custom Fields

SAP Open Connectors offers an extensive catalog of 3rd party integrations directly inside of SAP products. However, if a Connector does not exist, it can be built using Connector Builder, a simple wizard with a low to no code development. Furthermore, if the Connector does exist, but is missing a needed resource, it can be added, or extended.

In this blog, we’re going to focus on extending the Salesforce Open Connector to include the sobject resource. We’ll also explore adding a custom object to Salesforce and exposing in the Connector. Finally, we’ll add a custom field to a standard object in Salesforce.

 

Create a Salesforce Open Connector Instance

From the Open Connectors dashboard, click on Connectors and search for Salesforce. Hover over the Salesforce Sales Cloud Open Connector and click Authenticate.

Img 1 – Authenticating into a Salesforce Open Connector

 

After going through the Oauth flow and logging into Salesforce, you will have created a Salesforce Connector Instance. You can then either click on the “Explore the API Docs” button or go back to the screen above and click the blue bubble to access your Instance.

Img 2 – Accessing a created Salesforce Open Connector Instance

 

Now you can hover over the Instance and click on API Docs.

Img 3 – Accessing the API Docs of a created Salesforce Open Connector Instance

 

If the Resources tab is selected, these resources are editable.

Img 4 – Resources tab of a Connector allows resources to be edited

 

Click on the pencil icon to edit the resource. Let’s edit the reports resource.

Img 5 – Inspecting a resource in edit mode

 

Create a New Resource by Extending the Salesforce Open Connector

Let’s copy this format by clicking on Create New Resource to add the SOQL resource:

https://yourInstance.salesforce.com/services/data/v20.0/query/?q=SELECT+name+from+Account -H "Authorization: Bearer token"

We’ll just add the vendor path (the base URL is on the Setup page next to the Resources tab).

/services/data/v20.0/query/

 

Img 6 – SOQL documentation in Salesforce

 

The resource should look like this.

Img 7 – Adding the GET SOQL resource to the Salesforce Connector

 

After pressing Go, let’s add an empty parameter that we’ll nameĀ q for both the vendor name and name. It is type query and data type string. Make sure to add a description such as “Enter an SOQL query such as SELECT+name+from+Account

Img 8 – Adding an empty parameter to a newly created resource to the Salesforce Open Connector

 

There is one more thing we have to do before we can test this resource out. If you’ll notice in the Salesforce documentation above, the response payload has the results contained in a root key called records. Let’s add that root key by expanding the Configuration tab.

Img 9 – Adding a root key to a newly created resource in the Salesforce Open Connector

 

Now we are ready to test it out. Make sure the Connector Instance is selected (image above the ‘+ Authenticate Instance’ and under the word Instances. If selected, it will be bordered by the blue rectangle. Now click Try it Out and press Execute. You should see the response that lives in the results array.

Img 10 – Executing the newly created SOQL resource with a query in Salesforce Connector

 

Expose a Salesforce Custom Object in the Salesforce Open Connector

Let’s create a custom object in Salesforce.

Img 11 – Creating a custom object in the Salesforce UI called newobj__c.

 

We can then run GET /objects in the Connector Instance API Docs and we’ll see this new object automatically appear.

Img 12 – Executing the GET /objects resource to see the new custom object.

 

Img 13 – The newly added custom object shows up the GET /objects response in the Salesforce Connector

 

Let’s populate one newobj__c by using the POST /{objectName} resource that is provided by default on all Connector Instances.

Img 14 – Creating a new custom object record of newobj__c.

 

Now that we have populated a record, we can retrieve it with the GET /{objectName} provided resource.

Img 15 – Using GET /{objectName} to retrieve a custom object record in the Salesforce Connector

 

Here is the response.

Img 16 – The response from using GET /{objectName} for a custom Salesforce object

 

The fields will also be accessible using the GET objects/{objectName}/metadata

Img 17 – TheĀ GET objects/{objectName}/metadata in the Salesforce Open Connector Instance

 

Expose a Salesforce Custom Field in the Salesforce Open Connector

Let’s take this one step further and add a custom field to the standard object Contact.

Img 18 – A new field is added called mynewfield to the Contact standard object

 

Let’s now run the GET /contacts resource to see the new field.

Img 19 – The response from executing the GET /contacts resource after a custom fields was added

 

Finally, since the Common Resources use the GET /objects/{objectName}/metadata call, this new field will also be available for mapping.

Img 20 – When mapping to a Common Resource, the field choices are pulled directly from the GET /metadata call

 

In this blog, we’ve learned how to extend an Open Connector to add a resource. We’ve also seen how we can expose custom objects and custom fields in the Salesforce Open Connector.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.