When installing a package using the links it asks the user to confirm the addition of remote site settings.

When installing a package via the Metadata API using createMetadata() or the packaging API the remote site settings do not get activated and there is no prompt for the user to approve.

Does anyone know of a way to get the remote site settings to be activated during a package install via the API?

I assume there is not but interested to hear if there are any good ideas out there. I do not need code or anything but if there is a setting or field in the XML that can be passed it would be nice to know.

My current approach will be to develop a UI after the installation is complete for them to activate any inactive remote site settings within the namespace

UPDATE: Based on below answer

I tried using postman and my code and get HTTP error code 500 with the following:




<?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <urn:SessionHeader xmlns:urn="http://soap.sforce.com/2006/04/metadata">
            <createMetadata xmlns="http://soap.sforce.com/2006/04/metadata">
                <metadata xsi:type="InstalledPackage">

and I receive the following response. I tried putting the tag in all positions without but the results were the same

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
            <faultstring>Element {http://soap.sforce.com/2006/04/metadata}activateRss invalid at this location in type InstalledPackage</faultstring>

Must be a field returned by readMetadata and not available on createMetadata??

  • 1
    Named Credentials also get round this issue - if there is a named credential for the URL, it effectively authorizes the endpoint, and they don't need activating May 8 '19 at 14:26
  • @BritishBoyinDC named credentials in my use case would not be desireable as there is no ui that could be built around it and we would need 40 or so of them. Customers would not be happy lol. We got around it by automating the activation of the remote site via apex thanks to the org API’s being opened up to not need a remote site
    – Eric
    May 8 '19 at 16:06

According to the MDAPI documentation for InstalledPackage, there is a setting activateRss you can use as of API v43: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_installedpackage.htm

  • Thank you and I thought you nailed it, unfortunately it results in a 500 error. It works fine without it......Any thoughts? See updated question
    – Eric
    Jul 20 '18 at 1:15
  • Strange. No idea. Does it work if you use deploy rather than createMetadata?
    – Charles T
    Jul 20 '18 at 3:50
  • I would not expect it to. I can't use deploy anyway as I am doing this from apex....Gotta stick with HttpRequest and XML payload. Of course the whole metadata API thing from Apex confuses me and I hacked together the XML from examples and the SF documentation on object metadata so........
    – Eric
    Jul 20 '18 at 3:52

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.