开发者

Reference a remote site setting URL in Apex class?

开发者 https://www.devze.com 2023-03-22 20:27 出处:网络
I have a webservice class that will be in a managed package and distributed to multiple clients. The class currently has a variable with the ha开发者_JAVA百科rdcoded value of the server it\'s hitting.

I have a webservice class that will be in a managed package and distributed to multiple clients. The class currently has a variable with the ha开发者_JAVA百科rdcoded value of the server it's hitting.

The problem: the server will be different for each client, so a hardcoded value will not work.

I figured since each client will have to add their server to their remote site settings, the easiest way might be to grab the correct URL from their setting. Is this possible? Or is there another "right" way to accomplish this? Thanks


The best way I've found to save configuration values is to use Apex Custom Settings. To set the Remote Site settings programmatically you could use the Metadata API.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号