+ Start a Discussion
Dr. Thomas MillerDr. Thomas Miller 

Secret Secure Storage - Named Credentials

The Secret Secure Storage - Named Credentials code that you are asked to inject into APEX is incorrect. Rather than

public string getOpenPortal() { HttpRequest req = new HttpRequest(); req.setEndpoint('callout:MagicPortal'); req.setMethod('GET'); Http http = new Http(); HTTPResponse res = http.send(req); return res.getBody(); }

it should be

public void openPortal() {  HttpRequest req = new HttpRequest();  req.setEndpoint('callout:MagicPortal');  req.setMethod('GET');  Http http = new Http();  HTTPResponse res = http.send(req);  portalStatus = res.getBody() ;  }

I.e. do not return the body but put it into portalStatus.