I've got stuck with a simple problem.

When an Opportunity is updated to "Closed" and "Won" I want to send some data to another system.

So far I have:

  • update trigger
  • class handling HttpRequest and HttpResponse with a @future methods
  • I've added a public IP address with self-signed certificate to the Remote sites

It seems I'm not receiving any data. So I must have missed something, right?

p.s. Should I change the class for handling HttpRequest and HttpResponse to implement Queueable interface?

http class :

public class HttpCalloutService {

    public static void doCallout(Map<String,String> headers, String url, String data) {
        Http http = new Http();
        HttpRequest req = new HttpRequest();

        if(headers != null)
            for (String key: headers.keySet())
                req.setHeader(key, headers.get(key));



trigger OpportunityServiceCall on Opportunity (after update) {
    List<Opportunity> itemList = Trigger.new;

    // just for POC
    Blob headerValue = Blob.valueOf('user' + ':' + 'verysecurepassword');
    String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);

    Map<String, String> headers = new Map<String, String>();

    for(Opportunity opp : itemList) {
        if(opp.isWon && opp.isClosed ) {
           HttpCalloutService.doCallout(headers, 'https://x.x.x.x/sf/opp', JSON.serialize(opp));

Edit: when I tried the callout in the developer console (I didn't know about it) it threw an exception :

java.security.cert.CertificateException: No subject alternative names present

  • 2
    It would help if you included your code (both the trigger and the class with the @future method). Can't very well troubleshoot issues in code if the code isn't shared.
    – Derek F
    Jan 22, 2018 at 16:51
  • Have you tested your code to check if you can make that call? If your code is alright, you should be able to run the future method from outside the trigger, on the developer console, and with this check if Salesforce can connect to your external service. Jan 22, 2018 at 16:58
  • 1
    queueable vs future will make no difference to this issue
    – cropredy
    Jan 22, 2018 at 16:58
  • Just to be sure, do you have this external site set up as a remote site in your org? (Setup -> Administration heading -> Security Controls -> Remote Site Settings in SF classic)
    – Derek F
    Jan 22, 2018 at 17:09
  • 1
    @DerekF Yes, I tried to run the callout from the developer console and it threw an exception - "java.security.cert.CertificateException: No subject alternative names present"
    – Bakudan
    Jan 22, 2018 at 17:15

2 Answers 2


"No subject alternative names present" errors happen because you're specifying an IP address instead of a domain name. Change the IP to a domain endpoint and specify that in remote sites, and it will get you closer to figuring out how to get it to work, at least in solving the asked question here.


Regrettably, this may not be a viable solution for everybody.

We decided to move the endpoint to a sub domain on our site. Thus we solve the problem mentioned by DavidSchach and possibly the original problem with the self signed certificate which was used in the first place.

I think this could have been the main problem.

You must log in to answer this question.

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