I am building app for a managed package which is using metadata Api to setup page layout after installation of the package. And in order to do that, I have put https://v6.ap2.visual.force.com into remote site settings.

However, when the package is installed on client side, the domain name: ap2 is not fixed. It can be ap3, ap4 or anything possible. How should I set remote site settings in this case? Or should I just give them an instruction that they should set them up by themselves?

1 Answer 1


Either you can provide them a Manual Instruction to setup Remote Site Setting.

Or create a tool something we have in Apex Metedata API Wrapper. That page will automatically detect if the Salesforce instance you're using can access the metadata API and if it cannot access, it gives you the ability to specify the remote site setting you want, and automatically populate the correct url.

I suggest you go with second option because it would be more user friendly.

  • 1
    The second option, while more user-friendly, might raise a few eyebrows at Security Review time, though.
    – sfdcfox
    Commented Jan 5, 2017 at 5:18
  • 1
    Thank you for your advice. I am actually using that API wrapper. However, if the target org doesn't have access to metadata api, it simply can't be used.
    – Lance Shi
    Commented Jan 5, 2017 at 5:20
  • @LanceShi what you are saying and sfdcfox security review concern I think we might left with option 1 only. Commented Jan 5, 2017 at 5:30
  • Otherwise I can put every possible org domains in the security settings, which I highly doubt about it... Sounds really bad though
    – Lance Shi
    Commented Jan 5, 2017 at 5:35
  • 1
    @TusharSharma You are right. No. So up to now the first one is the only option. I will leave this question open for now to see if anyone else have some other ideas.
    – Lance Shi
    Commented Jan 5, 2017 at 5:51

You must log in to answer this question.

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