+ Start a Discussion
B kldB kld 

How to create External Lookup relationship between 2 External Objects


Following the above Site I have created External LookUp relationship between "Orders and OrderDetails"
What my question is how OrderId in OrderDetail object is exactly mapping to OrderId in Order Object, even though i select Order object as External Lookup but i haven't selected OrderId field to map. How is it mapping?.

My requirement is
1.I have External Case and External Account objects.
2.Account have fileds ID, Name, etc..., Case have AccountId, CaseNumber..etc..,
3.Now i want create External LookUp relationship between AccountId field in CASE and ID field in Account
4.So, that Case should be related list of Account
Agustina GarciaAgustina Garcia
I didn''t check in my org but actually I would say that the above example helps you to get what you need.

1. In your External Case object, you can have a field called ExtAccountId and populate it with a value. My advice is that this value should be unique, so try to keep it in mind. It will be like the usual Id of custom objects.
2. Once you create the External Data Source and the External Objects via Sync and Validate button, your ExtAccountId field will appear as Text or Number depending on how you have defined.
3. Unfortunatly Salesforce doesn't catch so easily relationships, so you would have to edit the field and change the Type to External Lookup.
    3.1. You can leave fields Label and lenght as it is right now, but you can modify it.
    3.2. Rember to set ExtAccountId as External Column Name value.
    3.3. Relate it to External Account and give it visibility as you desire.

Once you have that, remember to add the External Case object related list to External Account one.

Hope this help
B kldB kld
Thank U very much @Agustina

The information u provided above is giving clear picture what are the steps to remember in my Case.

But, I have a doubt, you advice as in "Step 1"--->  Am i need to make "ExtAccountId" this field Unique in the External data source i..e.., (SQL Server or other database which i am using)

Am i correct ?

Agustina GarciaAgustina Garcia
Sorry, my bad English :(

I woul try to say, try, at least in order to start with this example, to set a unique value. For instance, ExtAccountId values would be 1, 2, 3 .... and you will not find 1,2,3,2 ... 

Once you have this example working, you can try to complicate it.
B kldB kld
I tried what you suggested and I am getting your point Agustina,

I am facing problem with one issue

1.I have 2 Objects Case (Standard Object), ExtContact(External Object)
2.created external Lookup relationship from Case to ExtContact
User-added image
3.Till here It's working fine.
4.In the above screen shot f"anContact  :  2" which is LookUp to ExtConatct, Instead of default ExternalId value 2 i want Contact Name should populate in that field.
5.To achieve this what can i do..

Thanks for ur reply...
& one more thing, your english is good I can able to understand it.
Agustina GarciaAgustina Garcia
I hope to have understood your second issue, and if so, it is easy to fix ;)

In order to create a relationship between and external object and a custom / standard one, the type should be Indirect lookup instead of External Lookup. Remember that External Lookup is only (for now) to relate 2 external objects.

So having the use case. I want to get in my Standard object Case a related list with all my External Objet Case records. What do you have to do? 

1. Your External Case object must have a field that would help you to relate it with the Case. For instance "StandardCaseExternalId". You can populate it with the value you want, text, number ... actually it doesn't matter.
2. Go to Standard Case object and create a new field but type should be Text and check it as Unique and ExernalId. Remember to populate this new field with a value of your external object. 
3. After getting in your org your External Case object and the StandardCaseExternalId field, change its type to "Indirect Lookup". The next screen will ask you to which object you want to relate it. On this drop down list you would only get those objects that have an ExternalId field, so if you have not completed step2, Standard Case object will not appear. Then follow all steps and click save.
4. Finally add to Standard Case page layout the related list to your External Case.

As long as you have several External Object records which "StandardCaseExternalId" field match with a value of your new External Id field in your case, you would be able to see the data.

I don't think it will help too much, but just in case: http://es.slideshare.net/agarciaodeian/lightning-connect-london15 slide number 14. Where I show how an Indirect lookup looks like.
B kldB kld
Hi Agustina,

The points u mentioned is exactly correct.
U have taken example as Parent(Standard Object[Case]) - Child(ExternalObject [External Case]).
In my UseCase Parent(External Object) -- Child(Standard/Custom Object)
For this case the relationship should be ExternalLookup only I hope.

So, now when i'm creating a record in Standard/Custom(for ex. CASE) object i find Lookup field to ExternalObject(ExternalObjectCase), by using this I can select a value from External Object(for ex..ExternalObjectCase).
Plz concentrate on this point "After selecting a value from external Lookup i'll save that record, then I'll get Detail page of Standard CASE object in that page ExternalLookup field value showing as 1, 2,3... like that. I don't to show 1,2,3,4,..... Instead of that i want to show some other fields value from External object for ex.. ExtCaseNumber, ExtCaseAcc"

this i my issue..

Sorry, If i am troubling u in this Case by asking Question.....
"External Lookup is only (for now) to relate 2 external objects". Have the rules changed in Summer'15?
According to this table external lookup can link to standard object. External object will hold the id for the master.
https://help.salesforce.com/HTViewHelpDoc?id=external_object_relationships.htm (https://help.salesforce.com/HTViewHelpDoc?id=external_object_relationships.htm" target="_blank)
Also the standard lookup relation can be used instead of indirect lookup if the external object contains a column with salesforce id (custom case -> contact) right?
Agustina GarciaAgustina Garcia
As far as I know, Summer'15 doesn't include any changes on External Objects. But Winter '16 brings some. The most important one is that now, these objects are also writable. However I cannot give you too much information about that because I didn't check it yet. I will play with my Winter'16 orgs in the future weeks.

What I understand from this link is that yes, you can have a lookup relationship between your External Object and your Standard / Custom one. The only difference is that this field should be populated with the Salesforce Id. It means. You have an External Object with a Lookup to Account which name is MyAccount. This field value must be the Account Id in your external repository so it will be a link istead of a Text and you can navigate from your External Object to your Account without effort. And it is totally valid. But I really prefer Indirect Lookup. From my point of view, it is easier to keep in a External Repo the Account Name, for instance, intead of a number with 15-18 digits.  Just publish this morning a blog entry (http://agarciaodeian.com/2015/10/20/external-objects-what-lightning-connect-offers-to-us/) talking about External Objects and its feature. Take a look. Maybe it can help you.