0

I am new to salesforce and I have been trying to find answer for this requirement related to our application.

Basically I have a Custom Object Field_Config__c, on which I want to create a picklist field which should have options/values based on the fields defined on another object App_Config__c.

So If App_Config__c has 2 fields Custom_Field1__c, Custom_Field2__c, these fields should come as options or values in the picklist created on Field_Config__c.. and this should happen automatically, such that If I add a new field Custom_Field3__c on App_Config__c, this field should automatically come as an option in the Picklist field added on Field_Config__c.

Please help me on this

1
  • 1
    Hard to tell, since the actual underlying requirement isn't stated, but it is possible what you want to do may be achievable if you use custom metadata types instead of a custom object and use the entity and field definition field types. – Phil W Jan 24 at 8:11
1

Phil rightly points out in a comment that what you are trying to do might be best suited to using Custom Metadata Types, which can have relationships to other schema entities. You can't do that in a Custom Object.

Taking your question literally as written, what you are describing is not possible out of the box. There's two primary code-based solutions:

  • Build a custom UI to present field values for this "picklist", which would actually be a text field. The custom UI, such as a Lightning Web Component, could dynamically locate the available values and present a selection interface.
  • Build automation that calls the Tooling or Metadata APIs to refresh the values on an actual picklist field on a schedule. It wouldn't be real-time with creation of custom fields on your other object. I strongly discourage this solution; it's expensive, fragile, and requires elevated privileges.

The other option, of course, is redesigning your solution to obviate this requirement, which is what I typically recommend, and might result in your adopting Custom Metadata as referenced above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.