1

I need to create a remote setting setting with org instance URL using URL.getSalesforceBaseUrl().toExternalForm() on post install script of package installation.

Note : URL.getSalesforceBaseUrl().toExternalForm() is different than home page url.

I found http://www.exceptionlesscode.com/how-to-create-remote-site-settings-through-apex/ but in that step 2 it says, the remote site setting should be there (which i want in post install)

1 Answer 1

2

MetadataService under the hood uses SOAP API and make a callout which needs a remote site settings because it is trying to make a callout from apex. Salesforce released Native APEX metadata API last year but that has very limited functionality (Page layouts and Custom Metadata Types records only).https://developer.salesforce.com/blogs/engineering/2017/05/introducing-apex-metadata-api.html You have to create remote site settings using javascript on some VF page . You can have a look at this to get an idea..

2
  • I am not using any vf page. My application consist only lightning components, will it work on landing lightning component( i.e. custom home lighting cmp)?
    – Shilpa
    Mar 6, 2018 at 7:17
  • javascript will work on lightning component as well with one limitation .. It works only in Live mode of the lightning page and when accessed by user who has "API Enabled" and "Modify All Data" permissions. that means .. That user should access your component on Live page after adding it first time on Lightning page. Mar 7, 2018 at 14:38

You must log in to answer this question.

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