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

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.. https://gist.github.com/bigassforce/24fa4ded870284e11159

|improve this answer|||||
  • 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 '18 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. – balinder singh Mar 7 '18 at 14:38

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.