0

Why I can't create relationship between custom object and custom setting. When try to create lookup field in my custom object, custom settings are not listed in available objects.

2
  • Because I think custom settings are not stored in the database and custom settings are similar to properties file in java world.
    – javanoob
    Commented Dec 20, 2016 at 11:54
  • no need to create relationship between Custom setting and object. As Custom setting can be queried anywhere irrespective of what object you are working on.
    – Ankuli
    Commented Dec 20, 2016 at 13:07

1 Answer 1

5

No, you cannot create a relationship from a Standard Object or a Custom Object to a Custom Setting (nor the other way around).

As for why, the simple answer is that it is a platform limit. They were designed with this limitation in place, and it is a constraint you have to keep in mind when selecting Custom Settings as part of your solution.

From a technical perspective, I imagine part of the reasoning was to help the cloud architecture Salesforce has put in place scale to billions of transactions per day. As you may know, Custom Settings are stored in the application cache:

All custom settings data is exposed in the application cache, which enables efficient access without the cost of repeated queries to the database. This data can then be used by formula fields, validation rules, flows, Apex, and the SOAP API.

Injecting data dependencies to or from this layer of the application would increase the technical complexity of implementing that caching mechanism, at the very least, if not make it impossible.

1
  • I wish they would decouple platform secrets(protected custom settings) from custom settings then. I'd love to have a platform secret for each account that contains keys for the customer Commented Oct 14, 2021 at 2:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .