I am running into the exception
IO Exception: Unauthorized endpoint, please check Setup->Security->Remote site settings. endpoint = https://eu25.salesforce.com/services/Soap/m/42.0
when calling the Metadata API from an @future
Apex method
@Future(Callout=true)
private static void updateValueSet(Set<String> newTopics, String fieldName) {
MetadataService.MetadataPort mdapi = new MetadataService.MetadataPort();
mdapi.SessionHeader = new MetadataService.SessionHeader_element();
mdapi.SessionHeader.sessionId = UserInfo.getSessionId();
...
mdapi.updateMetadata(new List<MetadataService.Metadata>{ fieldMdApi });
}
even if this should work now as I have:
MetadataService
class usesv.46
andURL.getOrgDomainUrl().toExternalForm() + '/services/Soap/m/42.0'
- Org is on Winter '19 so
UserInfo.getSessionId()
even in@future
should not return null.
I think with having 1. and 2. in place there is no need for a Remote Site Setting anymore. Is this a bug?
https://eu25.salesforce.com/services/Soap/m/42.0
can be for any org in EU25 podTo bypass remote site settings, My Domain must be enabled in your org
, here's docs: releasenotes.docs.salesforce.com/en-us/winter19/release-notes/…