1

In one of my orgs, I have a simple Visualforce page with just an iframe inside. I don't want the URL to be hard-coded. I didn't develop anything else in this org.

To store this simple URL, which one should I use? Custom Label, Custom Setting or Custom Metadata Type?

1

I would prefer Custom Setting for your requirement. As per Salesforce guidelines below are purpose of all three

Custom settings are similar to custom objects and enable application developers to create custom sets of data, as well as create and associate custom data for an organization, profile, or specific user.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.

Custom metadata is customizable, deployable, packageable, and upgradeable application metadata. It mainly used to define for custom application development.

Custom labels enable developers to create multilingual applications by automatically presenting information in a user's native language.

So ideally Custom Setting is used for data setting.

  • thanks for your answer I used custom settings .I think also it is the best option . It is not complected to use instead of custom meta data and because it is just one url , it was not so enoying to recreate the record in the production . – Raphael D May 12 '19 at 14:00
1

I would use Custom label for this if its just one URL and avoid creating custom metadata or custom setting object.

Had it been a bunch of URL's i would have created a custom metadata object and stored the information in metadata.

The biggest advantage you get with custom metadata over custom settings is they can be deployed via metadata API with your regular deployment. Saves you from hassle of loading data which happens with custom settings.

Also if the hard coded URL is VF page URL i dont think you need to store it anywhere as you can access it using relative path in the lightning component.

  • Thank you for your answer , I finally used custom setting .It is working well and not complicated to use. – Raphael D May 12 '19 at 14:06
  • I hesitate to store URL's in custom metadata as one can get the source from git/svn he/she gets prod/live endpoints url and might end up hitting them and messing up data. Source tracking /deployable feature is kinda hickup here. – Pranay Jaiswal May 12 '19 at 21:15
  • Fair Point @PranayJaiswal, Since the OP mentioned this URL is used in iframe and nothing else is there in this org i suggested it. In my current project we store all our integration end points in custom settings. – RedDevil May 13 '19 at 5:51

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.