1

In a custom (Visualforce) setup page, I would like to provide links that open the "Manage" view for some of our custom settings.

Can URLFOR (or some other mechanism) provide such a URL? This also needs to work in Lightning Experience.

4

If you simply navigate to Setup > Custom Settings, and then copy the Manage link, it will look like below:

https://some-domain.my.salesforce.com/setup/ui/listCustomSettingsData.apexp?id=a02

So it should be fairly easy to generate programatically in Apex.

String relativePath = '/setup/ui/listCustomSettingsData.apexp';
String queryString = '?id=' + SObjectType.My_Setting__c.getKeyPrefix();
String manageUrl = URL.getOrgDomainUrl() + relativePath + queryString;

If you are creating this link in Visualforce and don't want to use Apex, I think it should still work using the $ObjectType global variable.

  • We have been burned a lot by this sort of URL hacking failing in Lightning so was wondering if there is a documented API approach. – Keith C Jun 5 at 14:50
  • @KeithC - if you've been burned by doing this programmtically in the past, can you store the URL for the custom setting in your custom setting (or another custom setting)? – PartOfTheOhana Jun 5 at 15:12
  • A Custom Label would be more appropriate here if that sort of configurability is desired. – Adrian Larson Jun 5 at 15:58
2

Managing Custom Settings in Lightning are always a challenge in my view. I would suggest taking a look at what Salesforce.org does here in the NPSP Package:

Basically, they created a wrapper VF page that then lets you navigate to each setting that lives in its own included VF page, and you can then edit/update with a simple shared controller. Yes, it is more overhead, but I just implemented it for someone else who had a bunch of settings for their managed package, and it provides a simple interface to update all custom settings.

  • Thanks for this; probably a bit too much work for my case but good to know. – Keith C Jun 5 at 14: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.