Implementing Custom Apex Adapter for Salesforce Connect

Complete Source code and demo of implementing Custom Apex Adapter for Salesforce Connect

As you might already know, using Salesforce Connect, we can display external data in Salesforce without physically creating record. Before Salesforce Connect, we had few options like Visualforce, Canvas etc. There are few options available in Salesforce Connect to show data like using protocols OData 2 or OData 4, cross org adapter , custom Apex adapter etc.

There could be scenario, like you already have license for Salesforce connect and want to use it to expose external data inside Salesforce. If you think about any custom solution using Lightning component or Visualforce, there could be many considerations and most important would be displaying data on user interface.

Using Salesforce Connect in above scenario will cut down your most of effort. Your data would be exposed as External Object and you can use it just like custom object. Just imagine, how cool it would be that you would not need to write a single line of code for data presentation.

Now, here your challenge comes. It is pretty much possible that external data does not support OData protocol. And you don’t have necessary middleware tool available to perform transformation and expose it as OData. It doesn’t mean that you cannot use Salesforce Connect. One of the feature of Salesforce Connect is writing and using Custom Adapter using Apex. Continue reading “Implementing Custom Apex Adapter for Salesforce Connect”

Creating Lookup field in External Object

Author posted by Jitendra on Posted on under category Categories Salesforce and tagged as Tags , with Leave a comment on Creating Lookup field in External Object

How to create a lookup field in Salesforce External Object

This is going to be very short note for readers and pretty much possible that you already know about problem and its solution. However, lets discuss problem first.

On External Object, we do get an option to create a lookup field. It looks very straight forward first, that create a lookup field and populate value in it. Below image shows, what happens when you try to populate newly created lookup field on External Object.

Lookup Field in External Object - Not Working
Lookup Field in External Object – Not Working

Did you observed, that Lookup field on External Object does not retain any value in Salesforce? Salesforce should have given some proper error message either while creating this field or after updating record.

 What is External Object in Salesforce ? This is kind of virtual object which does not exists in your Org. So, you created a field on Object which does not exists and then tried to populate it, what else you could have imagined ?

Resolution of this situation is very easy and would make lot of sense. Same solution applies to External Lookup field as well in Salesforce. All you have to do is, create a new field in Source system of type text first (length 18) and Sync your External Data Source so that new field will appear in your / destination Org. Now edit field’s data type to lookup or External lookup and it will work as expected.